Skip to content

Commit

Permalink
Merge pull request #228 from cwendt94/RemovePandaDep
Browse files Browse the repository at this point in the history
Remove Panda Dependencies
  • Loading branch information
cwendt94 authored Aug 23, 2021
2 parents 02088aa + bcab246 commit e4fd785
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 28 deletions.
13 changes: 0 additions & 13 deletions espn_api/hockey/player.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pandas as pd

from espn_api.utils.utils import json_parsing
from .constant import POSITION_MAP, STATS_MAP, PRO_TEAM_MAP, STATS_IDENTIFIER

Expand All @@ -16,7 +14,6 @@ def __init__(self, data):
self.proTeam = PRO_TEAM_MAP[json_parsing(data, 'proTeamId')]
self.injuryStatus = json_parsing(data, 'injuryStatus')
self.stats = {}
self.df = {}

'''
Options
Expand Down Expand Up @@ -48,16 +45,6 @@ def __init__(self, data):
def __repr__(self):
return 'Player(%s)' % (self.name,)

def to_df(self, stat: str) -> pd.DataFrame:
if stat not in self.df:
self.df[stat] = pd.DataFrame(self.stats[stat]['total'], index= [self.name])

self.df[stat]['Team'] = [self.proTeam]
self.df[stat]['Position'] = [self.position]
self.df[stat]['lineUpSlot'] = [self.lineupSlot]

return self.df[stat]

def get_stat_key(id: str) -> str:
if id[:2] in STATS_IDENTIFIER:
stat_type = STATS_IDENTIFIER[id[:2]]
Expand Down
14 changes: 1 addition & 13 deletions espn_api/hockey/team.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pandas as pd

from .constant import STATS_MAP
from .matchup import Matchup
from .player import Player
Expand All @@ -25,7 +23,6 @@ def __init__(self, data, member, roster, schedule, year):
self.roster = []
self.schedule = []
self.year = year
self.roster_df = {}

if 'valuesByStat' in data:
self.stats = {STATS_MAP[i]: j for i, j in data['valuesByStat'].items()}
Expand Down Expand Up @@ -60,13 +57,4 @@ def _fetch_schedule(self, data):
elif match['home']['teamId'] == self.team_id:
new_match = Matchup(match)
setattr(new_match, 'home_team', self)
self.schedule.append(new_match)

def get_roster_df(self, stat: str = None):
if not stat:
stat = 'Total {}'.format(self.year)

if stat not in self.roster_df:
self.roster_df[stat] = pd.concat([player.to_df(stat) for player in self.roster], sort=False)

return self.roster_df[stat]
self.schedule.append(new_match)
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
setup(
name='espn_api',
packages=find_packages(),
version='0.17.0',
version='0.18.0',
author='Christian Wendt',
description='ESPN API',
install_requires=['requests>=2.0.0,<3.0.0', 'pandas>=0.11.0,<=0.25.3', 'numpy>=1.15,<=1.17.5'],
install_requires=['requests>=2.0.0,<3.0.0'],
setup_requires=['nose>=1.0'],
test_suite='nose.collector',
tests_require=['nose', 'requests_mock', 'coverage'],
Expand Down

0 comments on commit e4fd785

Please sign in to comment.