etc/career_extractor.py
def _get_seasons(self)->DataFrame:
        """ get list of seasons played from csv files """
        # setup data
        players_df = pd.read_csv(self.players_fpath)
        old_rosters_df = pd.read_csv(self.old_rosters_fpath)

        # get pre 2009 seasons
        df_old_seasons = pd.DataFrame(old_rosters_df.drop(['Team', 'Number'], axis=1)\
                                                    .groupby(['Full_Name',
                                                              'Pos',
                                                              'name'])\
                                                    .Season.apply(list))\
                           .reset_index()\
                           .rename(columns={'Season': 'Seasons'})

        # get seasons 2009 onwards
        df_new_seasons = pd.DataFrame(players_df.drop('Team', axis=1)\
                                                .groupby(['Player_ID',
                                                          'Full_Name',
                                                          'name',
                                                          'Pos'])\
                                                .Season.apply(list))\
                           .reset_index()\
                           .rename(columns={'Season': 'Seasons'})


        # join old and new seasons
        df_joined = df_new_seasons.set_index(['Full_Name', 'Pos'])\
                                  .join(df_old_seasons.set_index(['Full_Name', 'Pos']),
                                        rsuffix='_old')

        return df_joined
 get list of seasons played from csv files 
get list of seasons played from csv files
get list of seasons played from csv files
def _get_seasons(self)->DataFrame:
        players_df = pd.read_csv(self.players_fpath)
        old_rosters_df = pd.read_csv(self.old_rosters_fpath)
        df_old_seasons = pd.DataFrame(old_rosters_df.drop(['Team', 'Number'], axis=1)\
                                                    .groupby(['Full_Name',
                                                              'Pos',
                                                              'name'])\
                                                    .Season.apply(list))\
                           .reset_index()\
                           .rename(columns={'Season': 'Seasons'})
        df_new_seasons = pd.DataFrame(players_df.drop('Team', axis=1)\
                                                .groupby(['Player_ID',
                                                          'Full_Name',
                                                          'name',
                                                          'Pos'])\
                                                .Season.apply(list))\
                           .reset_index()\
                           .rename(columns={'Season': 'Seasons'})
        df_joined = df_new_seasons.set_index(['Full_Name', 'Pos'])\
                                  .join(df_old_seasons.set_index(['Full_Name', 'Pos']),
                                        rsuffix='_old')
        return df_joined
def _get_seasons ( self ) -> DataFrame : players_df = pd . read_csv ( self . players_fpath ) old_rosters_df = pd . read_csv ( self . old_rosters_fpath ) df_old_seasons = pd . DataFrame ( old_rosters_df . drop ( [ 'Team' , 'Number' ] , axis = 1 ) . groupby ( [ 'Full_Name' , 'Pos' , 'name' ] ) . Season . apply ( list ) ) . reset_index ( ) . rename ( columns = { 'Season' : 'Seasons' } ) df_new_seasons = pd . DataFrame ( players_df . drop ( 'Team' , axis = 1 ) . groupby ( [ 'Player_ID' , 'Full_Name' , 'name' , 'Pos' ] ) . Season . apply ( list ) ) . reset_index ( ) . rename ( columns = { 'Season' : 'Seasons' } ) df_joined = df_new_seasons . set_index ( [ 'Full_Name' , 'Pos' ] ) . join ( df_old_seasons . set_index ( [ 'Full_Name' , 'Pos' ] ) , rsuffix = '_old' ) return df_joined
get list of seasons played from csv files
get list of seasons played from csv files
""" get list of seasons played from csv files """ # setup data # get pre 2009 seasons # get seasons 2009 onwards # join old and new seasons
self