Closed flutter-genius closed 4 years ago
thats because its trying to use the names in the top of the csv and they prob end up being in the same position in csv as cpt position
draftkings has repeated players names in csv
Thank you, Denwen. for solution, what is your suggestions?
yeah, it is correct that draftkings has repeated players names in csv
Is there way to solve this problem?
gimme a few to check my stuff
Thank you
where do you want herro and lebron locked
It is just example
ok
Can you check if this worked for lebron in capt position?
player = ['LeBron James']
position = ['CPT']
optimizer.add_players_group(PlayersGroup(players=[player for player in optimizer.players if player.name in player and list_intersection(player.positions, position)], min_from_group=1, ))
yeah, it is working for 1 locked player
you can prob repeat that set of code with another player group
but adjust the group and put position2 and player2
Ok, let me try with it. Thank you
if you need help editing the code let me know
Ok, thanks
any luck?
I am trying now. If I solve the problem, will message..
I solved the problem. If I try with get_player_by_id, it is working well. Thank you, Denwen
can you show an example of the code you used?
from pydfs_lineup_optimizer import Site, Sport, get_optimizer, PlayersGroup
optimizer = get_optimizer(Site.DRAFTKINGS_CAPTAIN_MODE, Sport.BASKETBALL)
optimizer.load_players_from_csv("DKSalaries.csv")
player1 = optimizer.get_player_by_id("15545066")
player2 = optimizer.get_player_by_id("15545029")
optimizer.add_player_to_lineup(player1)
optimizer.add_player_to_lineup(player2)
lineup_generator = optimizer.optimize(3)
for lineup in lineup_generator:
print(lineup)
of course, two locked players can't be CPT position.
thats what i figured when i saw your error
Great
there is different ways of doing stuff just have to figure out what works best
If you want, could you explain about it? Thank you
I tried with this code. If there are only one locked player, it is good. And with this code, I am getting below error. Please help me. Thank you.
Traceback (most recent call last): File ".\example.py", line 9, in <module> optimizer.add_player_to_lineup(player2) File "F:\source\018_django_lingups_optimizer\workspace\pydfs-lineup-optimizer-master\pydfs_lineup_optimizer\lineup_optimizer.py", line 224, in add_player_to_lineup raise LineupOptimizerException('You\'re already select all %s\'s' % '/'.join(player.positions)) pydfs_lineup_optimizer.exceptions.LineupOptimizerException: You're already select all CPT's PS F:\source\018_django_lingups_optimizer\workspace\pydfs-lineup-optimizer-master>