DimaKudosh / pydfs-lineup-optimizer

Daily Fantasy Sports lineup optimzer for all popular daily fantasy sports sites
MIT License
424 stars 157 forks source link

Can't get players #8

Closed Enrql closed 7 years ago

Enrql commented 7 years ago

Hi,

I can't get players with the 'optimizer.players', neither with the 'optimizer.get_player_by_name()' What am I doing wrong?

Thanks for the help!

DimaKudosh commented 7 years ago

Hi, are you sure that you loaded players? Can you provide more info what you got when trying to call optimizer.get_player_by_name() or optimizer.players?

steak-sauce commented 7 years ago

Hi Dima,

I'm also having some issues. It could be the formatting of my CSV file, but it imports without error. This is specifically for Yahoo football. Here's the CSV headers and an example row. Is 'Id' just something we come up with? Is it important that it match up with Yahoo's Player ID?

Id First Name Last Name Position Team Salary FPPG Injury Status
0 Tom Brady QB PAT 12 2 0

Is this correct?

Here are the outputs for the two commands mentioned above.

optimizer.players[0] <pydfs_lineup_optimizer.player.Player object at 0x026C7070>

optimizer.players[254] <pydfs_lineup_optimizer.player.Player object at 0x03009E90>

optimizer.get_player_by_name("Tom Brady") <pydfs_lineup_optimizer.player.Player object at 0x03010B90>

Using the documentations example:

for lineup in optimizer.optimize(n=10): ... print(lineup) ... print(lineup.lineup) # list of players ... print(lineup.fantasy_points_projection) ... print(lineup.salary_costs) ... Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-packages\pydfs_lineup_optimizer\lineup_optimizer.py", line 420, in optimize raise LineupOptimizerException("Can't generate lineups") pydfs_lineup_optimizer.exceptions.LineupOptimizerException: Can't generate lineups

Thanks!

DimaKudosh commented 7 years ago

Your csv has correct format and players are loaded. Maybe optimizer can't generate lineups because some other condition isn't fulfilled. For example you provide csv without defences or other positions that required for fantasy site. Can you send your csv to my email and I will look why it's happens?

steak-sauce commented 7 years ago

Thanks. I've sent the spreadsheet over to you.

DimaKudosh commented 7 years ago

I answered to your email.

ghost commented 6 years ago

Was this ever fixed? Having the same issue.

print(lineup.lineup)

Outputs

[<pydfs_lineup_optimizer.lineup.LineupPlayer object at 0x11088c7f0>, <pydfs_lineup_optimizer.lineup.LineupPlayer object at 0x110844908>, <pydfs_lineup_optimizer.lineup.LineupPlayer object at 0x110844898>, <pydfs_lineup_optimizer.lineup.LineupPlayer object at 0x1108440f0>, <pydfs_lineup_optimizer.lineup.LineupPlayer object at 0x110844320>, <pydfs_lineup_optimizer.lineup.LineupPlayer object at 0x1108442e8>, <pydfs_lineup_optimizer.lineup.LineupPlayer object at 0x110844278>, <pydfs_lineup_optimizer.lineup.LineupPlayer object at 0x110844160>, <pydfs_lineup_optimizer.lineup.LineupPlayer object at 0x110844978>]

When using a DraftKings NBA CSV.

jayna456 commented 4 years ago

@DimaKudosh , I am facing same issue. I am using load_players() and passing array of objects. but getting this

<generator object LineupOptimizer.optimize at 0x0000023F50241748>

Please help me out..