Code Monkey home page Code Monkey logo

Comments (1)

cbdm avatar cbdm commented on July 19, 2024

Looks like they saw this issue a little back but the fix didn't make it to the pip version yet: fd33a4f.
If you're using a virtual environment, you can just modify that same file in your installed version (VENV_PATH/lib/pythonXX/site-packages/sportsipy/nfl/roster.py), or you can follow the instructions on the readme to install from source.

However, I still had a problem even with their solution.
If not using the _slim=True option, player names were not correctly populated.

So when I was debugging this problem with something like:

from sportsipy.nfl.teams import Teams as NFL_Teams
teams = NFL_Teams()
for team in teams:
    print(team.roster.__dict__)

My output was something like this:

{'_team': 'DAL', '_slim': False, '_coach': 'Mike McCarthy', '_players': [None (AnaeBr00), None (AngeBr00), None (ArmsDo00), None (BashTa00), None (BernFr01), None (BiadTy00), None (BohaQu00), None (BrowAn02), None (BrowKy00), None (BrowNo00), None (BuntIa00), None (BurtDe00), None (CanaMa00), None (ClemCo00), None (CollLa01), None (CoopAm00), None (CoxxJa00), None (CoylTy00), None (DiggTr00), None (ElliEz00), None (FaolAu00), None (FarnMa00), None (FehoSi00), None (GallNe00), None (GallMi00), None (GiffLu00), None (GolsCh00), None (GoodC.00), None (GregRa00), None (HajrLi00), None (HamiJu00), None (HardJa01), None (HillTr00), None (HookMa00), None (JarwBl00), None (JoseKe02), None (KamaAz01), None (KazeDa00), None (KearJa00), None (KnigBr01), None (LambCe00), None (LawrDe00), None (LewiJo01), None (MartZa00), None (McGoCo01), None (McKeSe01), None (McQuJa00), None (MukuIs00), None (NealKe01), None (NsekTy00), None (OdigOs00), None (ParsMi00), None (PollTo00), None (PresDa01), None (RalsNi00), None (RushCo00), None (SchuDa00), None (SmitIt00), None (SmitJa05), None (SmitTy00), None (SpriJe00), None (SteeTe01), None (ThomDa05), None (TurnMa00), None (UrbaBr00), None (VandLe00), None (WatkCa00), None (WillCo00), None (WilsCe01), None (WilsDo01), None (WrigNa00), None (ZuerGr00)]}

You can see that the player_ids are correct but all their names are missing (i.,e., None); but if you dig into a player object it has all stats populated*.
So I added another change around those lines to populate the names also; I added player_instance._name = self._get_name(player) after the Player instance is created in line 1876 of the same file.
This is obviously not the best solution, _name was supposed to be set in _parse_player_information, but it's a quick and dirty fix to get us unstuck :)

* '_most_recent_season' wasn't set correctly in the one I checked:

>>> player
None (AdamMi21)
>>> player.__dict__
{'_most_recent_season': '2011', ..., '_player_id': 'AdamMi21', '_season': ['2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', 'Career'], ...}

from sportsipy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.