-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fanduel PlayersGroup Single Game Mode Q #304
Comments
You create player groups based on their player number. group = PlayersGroup(optimizer.player_pool.get_players('19610274', '19610353'), max_from_group=1) Tested and worked perfectly fine for me. |
tried it for fanduel with this code to limit each kicker in my lineup last night: didnt work. any ideas? |
anyone have ideas on how to get the playersgroup to work in single game format? for Fanduel? |
@Scottw1105 can you check this on Fanduel? This seems to work on DK, but i dont think it completely works for FD. still get both in some lineups together. |
Sorry to raise this zombie thread, but I am encountering this as well, specifically with FanDuel NFL single game mode. Here's my code: if position_limit == True: When I run this in a full lineup slate it does the job. Test without has an RB in the FLEX spot. Immediate test with those lines above However the same code appears to have no effect in single game mode. Is there a fix for this? Thank you! |
Actually for fd it makes a deepcopy of the normal players and adds mvp to
the player name , A workaround is just remove the deep copy and just use
normal player names, it uses deepcopy for fantasy points calculation and
fill in the mvp slot
…On Fri, Sep 13, 2024, 1:10 PM EdCarGoes ***@***.***> wrote:
Sorry to raise this zombie thread, but I am encountering this as well,
specifically with NFL single game mode. Here's my code:
if position_limit == True:
limit_group = PlayersGroup( players=[player for player in
optimizer.players if position_to_limit in player.positions],
max_from_group=position_limit_amount)
print(limit_group)
optimizer.add_players_group(limit_group)
When I run this in a full lineup slate it does the job. Test without has
an RB in the FLEX spot. Immediate test with those lines above
and setting position_limit = True, position_to_limit = "RB",
position_limit_amount = 2 excludes all RBs from the Flex positions. Lovely.
However the same code appears to have no effect in single game mode. Is
there a fix for this?
Thank you!
—
Reply to this email directly, view it on GitHub
<#304 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANBWO7QHG5XJS67H6246FE3ZWML7TAVCNFSM6AAAAABOFYM4X2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBZGQ4DSMBSGU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
One way to address the issue of having multiple copies of the same player
name when using deep copy in the import_players method is to create unique
identifiers for each player instance. This way, even if the players have
the same name, they will be treated as distinct players in the player group.
from uuid import uuid4
class FanDuelSingleGameCSVImporter(FanDuelCSVImporter):
def import_players(self):
players = super().import_players()
extra_players = []
for player in players:
if mvp:
mvp_player = deepcopy(player)
mvp_player.fppg *= 2
mvp_player._original_positions = player.positions
mvp_player.positions = ('MVP', )
mvp_player.identifier = str(uuid4()) # Add unique
identifier
extra_players.append(mvp_player)
if star:
star_player = deepcopy(player)
star_player.fppg *= 1.5
star_player._original_positions = player.positions
star_player.positions = ('STAR', )
star_player.identifier = str(uuid4()) # Add unique
identifier
extra_players.append(star_player)
if pro:
pro_player = deepcopy(player)
pro_player.fppg *= 1.2
pro_player._original_positions = player.positions
pro_player.positions = ('PRO', )
pro_player.identifier = str(uuid4()) # Add unique
identifier
extra_players.append(pro_player)
players.extend(extra_players)
return players
By adding a unique identifier to each player instance, you can ensure that
even players with the same name will be considered distinct when forming
player groups. This should help resolve the issue you are facing with deep
copies causing multiple instances of the same player name.
I am currently at work and unavailable to test this workaround. You may
consider adding this code and testing
…On Sat, Sep 14, 2024, 1:40 PM joseph offen ***@***.***> wrote:
Actually for fd it makes a deepcopy of the normal players and adds mvp to
the player name , A workaround is just remove the deep copy and just use
normal player names, it uses deepcopy for fantasy points calculation and
fill in the mvp slot
On Fri, Sep 13, 2024, 1:10 PM EdCarGoes ***@***.***> wrote:
> Sorry to raise this zombie thread, but I am encountering this as well,
> specifically with NFL single game mode. Here's my code:
>
> if position_limit == True:
> limit_group = PlayersGroup( players=[player for player in
> optimizer.players if position_to_limit in player.positions],
> max_from_group=position_limit_amount)
> print(limit_group)
> optimizer.add_players_group(limit_group)
>
> When I run this in a full lineup slate it does the job. Test without has
> an RB in the FLEX spot. Immediate test with those lines above
> and setting position_limit = True, position_to_limit = "RB",
> position_limit_amount = 2 excludes all RBs from the Flex positions. Lovely.
>
> However the same code appears to have no effect in single game mode. Is
> there a fix for this?
>
> Thank you!
>
> —
> Reply to this email directly, view it on GitHub
> <#304 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ANBWO7QHG5XJS67H6246FE3ZWML7TAVCNFSM6AAAAABOFYM4X2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBZGQ4DSMBSGU>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
|
This will affect
pydfs_lineup_optimizer/sites/fanduel/single_game/importer.py
…On Sat, Sep 14, 2024, 1:48 PM joseph offen ***@***.***> wrote:
One way to address the issue of having multiple copies of the same player
name when using deep copy in the import_players method is to create unique
identifiers for each player instance. This way, even if the players have
the same name, they will be treated as distinct players in the player group.
from uuid import uuid4
class FanDuelSingleGameCSVImporter(FanDuelCSVImporter):
def import_players(self):
players = super().import_players()
extra_players = []
for player in players:
if mvp:
mvp_player = deepcopy(player)
mvp_player.fppg *= 2
mvp_player._original_positions = player.positions
mvp_player.positions = ('MVP', )
mvp_player.identifier = str(uuid4()) # Add unique
identifier
extra_players.append(mvp_player)
if star:
star_player = deepcopy(player)
star_player.fppg *= 1.5
star_player._original_positions = player.positions
star_player.positions = ('STAR', )
star_player.identifier = str(uuid4()) # Add unique
identifier
extra_players.append(star_player)
if pro:
pro_player = deepcopy(player)
pro_player.fppg *= 1.2
pro_player._original_positions = player.positions
pro_player.positions = ('PRO', )
pro_player.identifier = str(uuid4()) # Add unique
identifier
extra_players.append(pro_player)
players.extend(extra_players)
return players
By adding a unique identifier to each player instance, you can ensure that
even players with the same name will be considered distinct when forming
player groups. This should help resolve the issue you are facing with deep
copies causing multiple instances of the same player name.
I am currently at work and unavailable to test this workaround. You may
consider adding this code and testing
On Sat, Sep 14, 2024, 1:40 PM joseph offen ***@***.***> wrote:
> Actually for fd it makes a deepcopy of the normal players and adds mvp to
> the player name , A workaround is just remove the deep copy and just use
> normal player names, it uses deepcopy for fantasy points calculation and
> fill in the mvp slot
>
> On Fri, Sep 13, 2024, 1:10 PM EdCarGoes ***@***.***> wrote:
>
>> Sorry to raise this zombie thread, but I am encountering this as well,
>> specifically with NFL single game mode. Here's my code:
>>
>> if position_limit == True:
>> limit_group = PlayersGroup( players=[player for player in
>> optimizer.players if position_to_limit in player.positions],
>> max_from_group=position_limit_amount)
>> print(limit_group)
>> optimizer.add_players_group(limit_group)
>>
>> When I run this in a full lineup slate it does the job. Test without has
>> an RB in the FLEX spot. Immediate test with those lines above
>> and setting position_limit = True, position_to_limit = "RB",
>> position_limit_amount = 2 excludes all RBs from the Flex positions. Lovely.
>>
>> However the same code appears to have no effect in single game mode. Is
>> there a fix for this?
>>
>> Thank you!
>>
>> —
>> Reply to this email directly, view it on GitHub
>> <#304 (comment)>,
>> or unsubscribe
>> <https://github.com/notifications/unsubscribe-auth/ANBWO7QHG5XJS67H6246FE3ZWML7TAVCNFSM6AAAAABOFYM4X2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBZGQ4DSMBSGU>
>> .
>> You are receiving this because you are subscribed to this thread.Message
>> ID: ***@***.***>
>>
>
|
Incredibly helpful! Thank you! I will do some testing and see if I can get this working. |
Trying to limit 1 qb per lineup at most.
oneqb= PlayersGroup([optimizer.get_player_by_name(Nickname) for Nickname in ('Trevor Lawrence', 'Joe Burrow')], max_from_group=1)
optimizer.add_players_group(oneqb)
heres the error
LineupOptimizerException: More than 1 player is found for: Trevor Lawrence
The text was updated successfully, but these errors were encountered: