DimaKudosh / pydfs-lineup-optimizer

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

Locking players to certain positions #384

Closed Scottw1105 closed 2 years ago

Scottw1105 commented 2 years ago

Just curious if there's a way to lock a specific player to a specific position?

Ex: LeBron James @ PF only.

Milkman9691 commented 2 years ago

Why not just lock the player in with optimizer.player_pool.get_player_by_name or with a PlayersGroup(optimizer.player_pool.get_players I believe you can use them together as well but why complicate it

BenikaH commented 2 years ago

You could also set LeBron's position in your CSV/JSON to PF instead of SF/PF/F depending on the site. So he would only be considered for the PF position.

Scottw1105 commented 2 years ago

Why not just lock the player in with optimizer.player_pool.get_player_by_name or with a PlayersGroup(optimizer.player_pool.get_players I believe you can use them together as well but why complicate it

So the reason I need a player locked to a specific position is for late swap. So yes, you can late swap to an "optimal" lineup but I do a lot to my potential lineups after that. So I'd like to have 150 lineups of LeBron @ PF with other pieces around that to determine which lineup I'm going to play.

Scottw1105 commented 2 years ago

You could also set LeBron's position in your CSV/JSON to PF instead of SF/PF/F depending on the site. So he would only be considered for the PF position.

That's a fantastic idea, I'm sure that'll do exactly what I need it to do, thanks so much!

Scottw1105 commented 2 years ago

Haha I'm silly, it's built right into the .lock_player class.

optimizer.player_pool.lock_player('Zach Collins', 'C') works like a charm.