muneebalam/scrapenhl2

View on GitHub
scrapenhl2/manipulate/manipulate.py

Summary

Maintainability
F
2 wks
Test Coverage

File manipulate.py has 1246 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import functools
import os
import os.path

import feather
Severity: Major
Found in scrapenhl2/manipulate/manipulate.py - About 3 days to fix

    Function _filter_for_players has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    def _filter_for_players(data, **kwargs):
        """
        Uses the players_on_ice, players_on_ice_for, players_on_ice_ag, acting_player, and receiving_player keyword
        arguments to filter the data.
        :param data: a dataframe with pbp data
    Severity: Minor
    Found in scrapenhl2/manipulate/manipulate.py - About 5 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function get_game_h2h_corsi has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_game_h2h_corsi(season, games, cfca=None):
        """
        This method gets H2H Corsi at 5v5 for the given game(s).
    
        :param season: int, the season
    Severity: Minor
    Found in scrapenhl2/manipulate/manipulate.py - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function infer_zones_for_faceoffs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def infer_zones_for_faceoffs(df, directions, xcol='X', ycol='Y', timecol='Time', focus_team=None, season=None,
                                 faceoffs=True):
        """
        Inferring zones for events from XY is hard--this method takes are of that by referencing against the JSON's 
        notes on which team went which direction in which period.
    Severity: Minor
    Found in scrapenhl2/manipulate/manipulate.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function get_directions_for_xy_for_season has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_directions_for_xy_for_season(season, team):
        """
        Gets directions for team specified using get_directions_for_xy_for_game
    
        :param season: int, the season
    Severity: Minor
    Found in scrapenhl2/manipulate/manipulate.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _teams_to_read has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _teams_to_read(**kwargs):
        """
        Method concatenates unique values from keyword arguments named team, team_for, and team_ag
        :param kwargs: kwargs as given to get_pbp_events, for example
        :return: a set of int (team IDs)
    Severity: Minor
    Found in scrapenhl2/manipulate/manipulate.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function infer_zones_for_faceoffs has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def infer_zones_for_faceoffs(df, directions, xcol='X', ycol='Y', timecol='Time', focus_team=None, season=None,
    Severity: Major
    Found in scrapenhl2/manipulate/manipulate.py - About 1 hr to fix

      Function convert_to_all_combos has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def convert_to_all_combos(df, fillval=0, *args):
          """
          This method takes a dataframe and makes sure all possible combinations of given arguments are present.
          For example, if you want df to have all combos of P1 and P2, it will create a dataframe with all possible combos,
          left join existing dataframe onto that, and return that df. Uses fillval to fill *all* non-key columns.
      Severity: Minor
      Found in scrapenhl2/manipulate/manipulate.py - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Avoid deeply nested control flow statements.
      Open

                          for p in playersonice:
                              querystrings.append('{0:s}{1:s} == {2:d}'.format(hr, suf, p))
                  querystring = ' | '.join(querystrings)
      Severity: Major
      Found in scrapenhl2/manipulate/manipulate.py - About 45 mins to fix

        Function add_score_adjustment_to_team_pbp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def add_score_adjustment_to_team_pbp(df):
            """
            Adds AdjFF and AdjFA
        
            :param df: dataframe
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function generate_5v5_player_log has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def generate_5v5_player_log(season):
            """
            Takes the play by play and adds player 5v5 info to the master player log file, noting TOI, CF, etc.
            This takes awhile because it has to calculate TOICOMP.
            :param season: int, the season
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function _get_5v5_player_game_fa has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def _get_5v5_player_game_fa(season, team, gc):
            """
            A helper method for get_5v5_player_game_cfca and _gfga.
        
            :param season: int, the season
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function _filter_for_games has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def _filter_for_games(data, **kwargs):
            """
            Uses the start_game, end_game, and season_types keyword arguments to filter the data.
            :param data: a dataframe with pbp data
            :param kwargs: kwargs as given to get_pbp_events, for example
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function generate_toicomp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def generate_toicomp(season):
            """
            Generates toicomp at a player-game level
            :param season: int, the season
            :return: df,
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function get_directions_for_xy_for_game has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_directions_for_xy_for_game(season, game):
            """
            It doesn't seem like there are rules for whether positive X in XY event locations corresponds to offensive zone
            events, for example. Best way is to use fields in the the json.
        
        
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function team_5v5_shot_rates_by_score has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def team_5v5_shot_rates_by_score(season):
            """
            Uses the team TOI and PBP logs to group by team and game and score state for this season. 5v5 only.
        
            :param season: int, the season
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                if cfca is None:
                    corsi.loc[:, 'HomeCorsi'] = corsi.Team.apply(lambda x: 1 if x == hometeam else -1)
                elif cfca == 'cf':
                    corsi.loc[:, 'HomeCorsi'] = corsi.Team.apply(lambda x: 1 if x == hometeam else 0)
                elif cfca == 'ca':
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 1 day to fix
        scrapenhl2/scrape/parse_pbp.py on lines 344..349

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 158.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                toi = toi[['Game', 'Team', 'TeamScore', 'OppScore', 'Time']] \
                    .assign(ScoreState=toi.TeamScore - toi.OppScore) \
                    .drop_duplicates() \
                    .drop({'TeamScore', 'OppScore', 'Time'}, axis=1) \
                    .assign(Secs=1) \
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 2 other locations - About 4 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 1546..1551
        scrapenhl2/manipulate/manipulate.py on lines 1589..1594

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 79.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                pbp = pbp[['Game', 'Team', 'TeamScore', 'OppScore', 'Index']] \
                    .assign(ScoreState=pbp.TeamScore - pbp.OppScore) \
                    .drop_duplicates() \
                    .drop({'TeamScore', 'OppScore', 'Index'}, axis=1) \
                    .assign(Count=1) \
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 2 other locations - About 4 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 1546..1551
        scrapenhl2/manipulate/manipulate.py on lines 1581..1586

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 79.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                toi = toi[['Game', 'Team', 'Time', 'TeamScore', 'OppScore']] \
                    .assign(ScoreState=toi.TeamScore - toi.OppScore) \
                    .drop_duplicates() \
                    .drop({'Time', 'TeamScore', 'OppScore'}, axis=1) \
                    .assign(Secs=1) \
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 2 other locations - About 4 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 1581..1586
        scrapenhl2/manipulate/manipulate.py on lines 1589..1594

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 79.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        def get_5v5_player_log(season, force_create=False):
            """
        
            :param season: int, the season
            :param force_create: bool, create from scratch even if it exists?
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 2 other locations - About 4 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 31..44
        scrapenhl2/manipulate/manipulate.py on lines 455..470

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        def get_player_toion_toioff_file(season, force_create=False):
            """
        
            :param season: int, the season
            :param force_create: bool, should this be read from file if possible, or created from scratch
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 2 other locations - About 4 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 455..470
        scrapenhl2/manipulate/manipulate.py on lines 514..527

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        def get_toicomp_file(season, force_create=False):
            """
            If you want to rewrite the TOI60 file, too, then run get_player_toion_toioff_file with force_create=True before
            running this method.
            :param season: int, the season
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 2 other locations - About 4 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 31..44
        scrapenhl2/manipulate/manipulate.py on lines 514..527

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            playersonice = helpers.melt_helper(fives[cols_to_keep],
                                               id_vars='Time', var_name='P', value_name='PlayerID') \
                .drop('P', axis=1) \
                .merge(pos, how='left', left_on='PlayerID', right_on='ID') \
                .query('Pos != "D"') \
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 3 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 1291..1296

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 72.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            playersonice = helpers.melt_helper(fives[cols_to_keep],
                                               id_vars='Time', var_name='P', value_name='PlayerID') \
                .drop('P', axis=1) \
                .merge(pos, how='left', left_on='PlayerID', right_on='ID') \
                .query('Pos == "D"') \
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 3 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 1260..1265

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 72.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if cfca is None:
                    pairs.loc[pairs.Team1 == 'R', 'HomeCorsi'] = pairs.loc[pairs.Team1 == 'R', 'HomeCorsi'] * -1
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 2 hrs to fix
        scrapenhl2/manipulate/combos.py on lines 101..102

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 59.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            df.loc[:, metrics['FOFF']] = df[metrics['TeamF']] - df[metrics['FON']]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 2 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 1112..1112

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 52.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            df.loc[:, metrics['AOFF']] = df[metrics['TeamA']] - df[metrics['AON']]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 2 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 1111..1111

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 52.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                pbp = pbp[['Time', 'Event', 'Team']] \
                    .merge(toi[['Time', 'R1', 'R2', 'R3', 'R4', 'R5', 'H1', 'H2', 'H3', 'H4', 'H5',
                                'HomeStrength', 'RoadStrength']], how='inner', on='Time')
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 1 hr to fix
        scrapenhl2/scrape/parse_pbp.py on lines 333..335

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 48.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 9 locations. Consider refactoring.
        Open

                df2.loc[(df2['_X'] == -20) & (df2['_Y'] == -22), 'EventLoc'] = 'NDR'
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 8 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 982..982
        scrapenhl2/manipulate/manipulate.py on lines 983..983
        scrapenhl2/manipulate/manipulate.py on lines 984..984
        scrapenhl2/manipulate/manipulate.py on lines 985..985
        scrapenhl2/manipulate/manipulate.py on lines 987..987
        scrapenhl2/manipulate/manipulate.py on lines 988..988
        scrapenhl2/manipulate/manipulate.py on lines 989..989
        scrapenhl2/manipulate/manipulate.py on lines 992..992

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 9 locations. Consider refactoring.
        Open

                df2.loc[(df2['_X'] == 20) & (df2['_Y'] == -22), 'EventLoc'] = 'NOR'
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 8 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 982..982
        scrapenhl2/manipulate/manipulate.py on lines 983..983
        scrapenhl2/manipulate/manipulate.py on lines 984..984
        scrapenhl2/manipulate/manipulate.py on lines 985..985
        scrapenhl2/manipulate/manipulate.py on lines 987..987
        scrapenhl2/manipulate/manipulate.py on lines 989..989
        scrapenhl2/manipulate/manipulate.py on lines 990..990
        scrapenhl2/manipulate/manipulate.py on lines 992..992

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 9 locations. Consider refactoring.
        Open

                df2.loc[(df2['_X'] == 69) & (df2['_Y'] == 22), 'EventLoc'] = 'OL'
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 8 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 983..983
        scrapenhl2/manipulate/manipulate.py on lines 984..984
        scrapenhl2/manipulate/manipulate.py on lines 985..985
        scrapenhl2/manipulate/manipulate.py on lines 987..987
        scrapenhl2/manipulate/manipulate.py on lines 988..988
        scrapenhl2/manipulate/manipulate.py on lines 989..989
        scrapenhl2/manipulate/manipulate.py on lines 990..990
        scrapenhl2/manipulate/manipulate.py on lines 992..992

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 9 locations. Consider refactoring.
        Open

                df2.loc[(df2['_X'] == -69) & (df2['_Y'] == -22), 'EventLoc'] = 'DR'
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 8 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 982..982
        scrapenhl2/manipulate/manipulate.py on lines 983..983
        scrapenhl2/manipulate/manipulate.py on lines 984..984
        scrapenhl2/manipulate/manipulate.py on lines 987..987
        scrapenhl2/manipulate/manipulate.py on lines 988..988
        scrapenhl2/manipulate/manipulate.py on lines 989..989
        scrapenhl2/manipulate/manipulate.py on lines 990..990
        scrapenhl2/manipulate/manipulate.py on lines 992..992

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            if 'receiving_player' in kwargs:
                p = players.player_as_id(kwargs['receiving_player'])
                data = data[data.Recipient == p]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 4 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 240..242
        scrapenhl2/manipulate/manipulate.py on lines 316..318
        scrapenhl2/manipulate/manipulate.py on lines 323..325
        scrapenhl2/manipulate/manipulate.py on lines 326..328

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 9 locations. Consider refactoring.
        Open

                df2.loc[(df2['_X'] == 69) & (df2['_Y'] == -22), 'EventLoc'] = 'OR'
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 8 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 982..982
        scrapenhl2/manipulate/manipulate.py on lines 984..984
        scrapenhl2/manipulate/manipulate.py on lines 985..985
        scrapenhl2/manipulate/manipulate.py on lines 987..987
        scrapenhl2/manipulate/manipulate.py on lines 988..988
        scrapenhl2/manipulate/manipulate.py on lines 989..989
        scrapenhl2/manipulate/manipulate.py on lines 990..990
        scrapenhl2/manipulate/manipulate.py on lines 992..992

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 9 locations. Consider refactoring.
        Open

                df2.loc[(df2['_X'] == 0) & (df2['_Y'] == 0), 'EventLoc'] = 'N'
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 8 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 982..982
        scrapenhl2/manipulate/manipulate.py on lines 983..983
        scrapenhl2/manipulate/manipulate.py on lines 984..984
        scrapenhl2/manipulate/manipulate.py on lines 985..985
        scrapenhl2/manipulate/manipulate.py on lines 987..987
        scrapenhl2/manipulate/manipulate.py on lines 988..988
        scrapenhl2/manipulate/manipulate.py on lines 989..989
        scrapenhl2/manipulate/manipulate.py on lines 990..990

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            if 'road_team' in kwargs:
                teamid = team_info.team_as_id(kwargs['road_team'])
                data = data[data.Road == teamid]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 4 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 240..242
        scrapenhl2/manipulate/manipulate.py on lines 244..246
        scrapenhl2/manipulate/manipulate.py on lines 316..318
        scrapenhl2/manipulate/manipulate.py on lines 323..325

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            if 'team_for' in kwargs:
                teamid = team_info.team_as_id(kwargs['team_for'])
                data = data[data.Team == teamid]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 4 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 240..242
        scrapenhl2/manipulate/manipulate.py on lines 244..246
        scrapenhl2/manipulate/manipulate.py on lines 323..325
        scrapenhl2/manipulate/manipulate.py on lines 326..328

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 9 locations. Consider refactoring.
        Open

                df2.loc[(df2['_X'] == -20) & (df2['_Y'] == 22), 'EventLoc'] = 'NDL'
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 8 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 982..982
        scrapenhl2/manipulate/manipulate.py on lines 983..983
        scrapenhl2/manipulate/manipulate.py on lines 984..984
        scrapenhl2/manipulate/manipulate.py on lines 985..985
        scrapenhl2/manipulate/manipulate.py on lines 987..987
        scrapenhl2/manipulate/manipulate.py on lines 988..988
        scrapenhl2/manipulate/manipulate.py on lines 990..990
        scrapenhl2/manipulate/manipulate.py on lines 992..992

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 9 locations. Consider refactoring.
        Open

                df2.loc[(df2['_X'] == -69) & (df2['_Y'] == 22), 'EventLoc'] = 'DL'
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 8 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 982..982
        scrapenhl2/manipulate/manipulate.py on lines 983..983
        scrapenhl2/manipulate/manipulate.py on lines 985..985
        scrapenhl2/manipulate/manipulate.py on lines 987..987
        scrapenhl2/manipulate/manipulate.py on lines 988..988
        scrapenhl2/manipulate/manipulate.py on lines 989..989
        scrapenhl2/manipulate/manipulate.py on lines 990..990
        scrapenhl2/manipulate/manipulate.py on lines 992..992

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            if 'acting_player' in kwargs:
                p = players.player_as_id(kwargs['acting_player'])
                data = data[data.Actor == p]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 4 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 244..246
        scrapenhl2/manipulate/manipulate.py on lines 316..318
        scrapenhl2/manipulate/manipulate.py on lines 323..325
        scrapenhl2/manipulate/manipulate.py on lines 326..328

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            if 'home_team' in kwargs:
                teamid = team_info.team_as_id(kwargs['home_team'])
                data = data[data.Home == teamid]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 4 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 240..242
        scrapenhl2/manipulate/manipulate.py on lines 244..246
        scrapenhl2/manipulate/manipulate.py on lines 316..318
        scrapenhl2/manipulate/manipulate.py on lines 326..328

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 9 locations. Consider refactoring.
        Open

                df2.loc[(df2['_X'] == 20) & (df2['_Y'] == 22), 'EventLoc'] = 'NOL'
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 8 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 982..982
        scrapenhl2/manipulate/manipulate.py on lines 983..983
        scrapenhl2/manipulate/manipulate.py on lines 984..984
        scrapenhl2/manipulate/manipulate.py on lines 985..985
        scrapenhl2/manipulate/manipulate.py on lines 988..988
        scrapenhl2/manipulate/manipulate.py on lines 989..989
        scrapenhl2/manipulate/manipulate.py on lines 990..990
        scrapenhl2/manipulate/manipulate.py on lines 992..992

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            teamfo.loc[:, 'StartWL'] = teamfo.Team.apply(lambda x: 'W' if x == team else 'L')
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 1598..1598

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 42.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                pbp.loc[:, 'CFCA'] = pbp.Team.apply(lambda x: 'CF' if x == team else 'CA')
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 793..793

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 42.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            starts = df[df.ShiftStart == 1][['PlayerID', 'Game', 'Time', 'ShiftIndex']].rename(columns={'Time': 'StartTime'})
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 768..768

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 42.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            ends = df[df.ShiftEnd == 1][['PlayerID', 'Game', 'Time', 'ShiftIndex']].rename(columns={'Time': 'EndTime'})
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 767..767

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 42.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            road_games.loc[:, 'ScoreDiff'] = road_games.ScoreDiff.apply(lambda x: max(min(x, 3), -3))
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 1649..1649

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 40.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            home_games.loc[:, 'ScoreDiff'] = home_games.ScoreDiff.apply(lambda x: max(min(x, 3), -3))
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 1661..1661

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 40.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

                rh = road.merge(home.drop_duplicates(), how='inner', on='Time', suffixes=['1', '2']).assign(Team1='R', Team2='H')
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 3 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 1468..1468
        scrapenhl2/manipulate/manipulate.py on lines 1469..1469
        scrapenhl2/manipulate/manipulate.py on lines 1471..1471

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 39.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

                hh = home.merge(home.drop_duplicates(), how='inner', on='Time', suffixes=['1', '2']).assign(Team1='H', Team2='H')
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 3 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 1469..1469
        scrapenhl2/manipulate/manipulate.py on lines 1470..1470
        scrapenhl2/manipulate/manipulate.py on lines 1471..1471

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 39.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

                hr = home.merge(road.drop_duplicates(), how='inner', on='Time', suffixes=['1', '2']).assign(Team1='H', Team2='R')
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 3 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 1468..1468
        scrapenhl2/manipulate/manipulate.py on lines 1470..1470
        scrapenhl2/manipulate/manipulate.py on lines 1471..1471

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 39.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

                rr = road.merge(road.drop_duplicates(), how='inner', on='Time', suffixes=['1', '2']).assign(Team1='R', Team2='R')
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 3 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 1468..1468
        scrapenhl2/manipulate/manipulate.py on lines 1469..1469
        scrapenhl2/manipulate/manipulate.py on lines 1470..1470

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 39.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            cols_to_keep = ['Time'] + ['{0:s}{1:d}'.format(homeroad, i + 1) for i in range(5)]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 2 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 1226..1226
        scrapenhl2/manipulate/manipulate.py on lines 1290..1290

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 38.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            cols_to_keep = ['Time'] + ['{0:s}{1:d}'.format(homeroad, i + 1) for i in range(5)]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 2 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 1259..1259
        scrapenhl2/manipulate/manipulate.py on lines 1290..1290

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 38.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            cols_to_keep = ['Time'] + ['{0:s}{1:d}'.format(homeroad, i + 1) for i in range(5)]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 2 other locations - About 1 hr to fix
        scrapenhl2/manipulate/manipulate.py on lines 1226..1226
        scrapenhl2/manipulate/manipulate.py on lines 1259..1259

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 38.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            ns.loc[:, 'Pos2'] = ns.Pos2.apply(lambda x: x + 'N')
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 50 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 716..716

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 36.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            for col in boxcars.columns:
                boxcars.loc[:, col] = boxcars[col].fillna(0)
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 50 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 1138..1139

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 36.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            for col in df2.columns:
                df2.loc[:, col] = df2[col].fillna(0)
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 50 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 621..622

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 36.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            sums.loc[:, 'Pos2'] = sums.Pos2.apply(lambda x: x + 'Sum')
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 50 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 720..720

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 36.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    temp = toi \
                        .merge(cfca, how='left', on=['PlayerID', 'Game']) \
                        .merge(gfga, how='left', on=['PlayerID', 'Game']) \
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 45 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 613..614

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 35.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            boxcars = ig.merge(primaries, how='outer', on=['Game', 'PlayerID']) \
                .merge(secondaries, how='outer', on=['Game', 'PlayerID']) \
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 45 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 1027..1029

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 35.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            df2.loc[:, '_X'] = df2[xcol] * df2['_Mult3']
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 40 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 979..979

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 34.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

            toi60.loc[:, 'TOI%'] = toi60.TOION / (toi60.TOION + toi60.TOIOFF)
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 5 other locations - About 40 mins to fix
        scrapenhl2/plot/team_score_shot_rate.py on lines 31..31
        scrapenhl2/plot/usage.py on lines 33..33
        scrapenhl2/plot/usage.py on lines 97..97
        scrapenhl2/plot/usage.py on lines 159..159
        scrapenhl2/plot/visualization_helper.py on lines 259..259

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 34.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            df2.loc[:, '_Y'] = df2[ycol] * df2['_Mult3']
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 40 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 978..978

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 34.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

            fives = toi[(toi.HomeStrength == "5") & (toi.RoadStrength == "5")]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 5 other locations - About 35 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 1225..1225
        scrapenhl2/manipulate/manipulate.py on lines 1258..1258
        scrapenhl2/manipulate/manipulate.py on lines 1400..1401
        scrapenhl2/manipulate/manipulate.py on lines 1402..1403
        scrapenhl2/scrape/parse_toi.py on lines 546..546

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 33.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

            fives = toi[(toi.HomeStrength == "5") & (toi.RoadStrength == "5")]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 5 other locations - About 35 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 1225..1225
        scrapenhl2/manipulate/manipulate.py on lines 1289..1289
        scrapenhl2/manipulate/manipulate.py on lines 1400..1401
        scrapenhl2/manipulate/manipulate.py on lines 1402..1403
        scrapenhl2/scrape/parse_toi.py on lines 546..546

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 33.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

                data = data[(data.Home == teamid) | (data.Road == teamid)]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 3 other locations - About 35 mins to fix
        scrapenhl2/scrape/games.py on lines 43..43
        scrapenhl2/scrape/games.py on lines 46..46
        scrapenhl2/scrape/teams.py on lines 136..136

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 33.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

            fives = toi[(toi.HomeStrength == "5") & (toi.RoadStrength == "5")]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 5 other locations - About 35 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 1258..1258
        scrapenhl2/manipulate/manipulate.py on lines 1289..1289
        scrapenhl2/manipulate/manipulate.py on lines 1400..1401
        scrapenhl2/manipulate/manipulate.py on lines 1402..1403
        scrapenhl2/scrape/parse_toi.py on lines 546..546

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 33.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

            elif 'TeamStrength' in colnames and 'OppStrength' in colnames:
                fives = df[(df.TeamStrength == "5") & (df.OppStrength == "5")]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 5 other locations - About 35 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 1225..1225
        scrapenhl2/manipulate/manipulate.py on lines 1258..1258
        scrapenhl2/manipulate/manipulate.py on lines 1289..1289
        scrapenhl2/manipulate/manipulate.py on lines 1400..1401
        scrapenhl2/scrape/parse_toi.py on lines 546..546

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 33.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            indivtotals = helpers.melt_helper(indivtotals[['Game', 'TeamEvent', 'Team1', 'Team2', 'Team3', 'Team4', 'Team5']],
                                              id_vars=['Game', 'TeamEvent'],
                                              value_vars=['Team1', 'Team2', 'Team3', 'Team4', 'Team5'],
                                              var_name='Temp', value_name='PlayerID') \
                .drop('Temp', axis=1) \
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 35 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 1084..1088

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 33.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

            if 'HomeStrength' in colnames and 'RoadStrength' in colnames:
                fives = df[(df.HomeStrength == "5") & (df.RoadStrength == "5")]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 5 other locations - About 35 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 1225..1225
        scrapenhl2/manipulate/manipulate.py on lines 1258..1258
        scrapenhl2/manipulate/manipulate.py on lines 1289..1289
        scrapenhl2/manipulate/manipulate.py on lines 1402..1403
        scrapenhl2/scrape/parse_toi.py on lines 546..546

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 33.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            teamtotals = pbp[['Game', 'TeamEvent']] \
                .assign(Count=1) \
                .groupby(['Game', 'TeamEvent']).count().reset_index() \
                .pivot_table(index='Game', columns='TeamEvent', values='Count').reset_index() \
                .rename(columns={metrics['F']: metrics['TeamF'], metrics['A']: metrics['TeamA']})
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 35 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 1093..1101

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 33.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            if 'start_date' in kwargs:
                minseason = max(helpers.infer_season_from_date(kwargs['start_date']), minseason)
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 30 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 350..351

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 32.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            if 'end_date' in kwargs:
                maxseason = max(helpers.infer_season_from_date(kwargs['end_date']), maxseason)
        Severity: Minor
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 30 mins to fix
        scrapenhl2/manipulate/manipulate.py on lines 345..346

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 32.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status