Closed dexter1964 closed 5 years ago
Looks like it's problem with pitchers, DK split pitcher position to 2 positions: SP and RP, so optimizer expect players positions as in DK and it can't find any SP/RP in your roster. You can replace P position with SP/RP when you parsing players.
Thank you so much. you were 100% right!!!, I changed my PlayerPosition from "P" to "SP/RP" and it worked perfectly. Thanks again!!!
Hello again, I know this is my fault and my own stupidity, but can you please help. I got your optimizer working by populating the Players through an SQL query using site.FANDUEL (works great!). But I can't seem to get it to work with the DRAFTKINGS Optimizer.
optimizer = get_optimizer(Site.DRAFTKINGS, Sport.BASEBALL)
the DRAFTKINGS optimizer works great using the CSV file Loader.
I believe my data looks good, in my database. Do you think there might be something wrong with my data? (I'm also attaching an Export of my scraped MLB Data.
I've tried to include everything I could think of. Can you please point me in the right direction?
20190326-MLBRosterData.zip
Can you please help? Thank you so much!, Larry
##################################################### Traceback (most recent call last): File "C:\Users\Larry Brown\AppData\Local\Programs\Python\Python37\lib\site-packages\pydfs_lineup_optimizer\lineup_optimizer.py", line 385, in optimize solved_variables = solver.solve() File "C:\Users\Larry Brown\AppData\Local\Programs\Python\Python37\lib\site-packages\pydfs_lineup_optimizer\solvers\pulp_solver.py", line 47, in solve raise SolverException('Unable to solve') pydfs_lineup_optimizer.solvers.exceptions.SolverException: Unable to solve
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File ".\MLBDKTodaysTop3Lineups.py", line 143, in
for lineup in lineup_generator:
File "C:\Users\Larry Brown\AppData\Local\Programs\Python\Python37\lib\site-packages\pydfs_lineup_optimizer\lineup_optimizer.py", line 397, in optimize
raise LineupOptimizerException('Can\'t generate lineups')
pydfs_lineup_optimizer.exceptions.LineupOptimizerException: Can't generate lineups
########################################################
`from pydfs_lineup_optimizer import Site, Sport, get_optimizer, Player
optimizer = get_optimizer(Site.DRAFTKINGS, Sport.BASEBALL)
players = []
roster = mF.getAllMLBPlayerInfo('DK') for i, player_info in enumerate(roster): name = player_info[0].split(' ')
optimizer.load_players(players)` ######################################################## OUTPUT from Print Statements above: player_info[280] : PlayerName : Eric Stamets Name[0] : Eric Name[1] : Stamets TeamShort : CLE Position : ['SS'] Salary : 2700.0 FanPoints : 5.36 player_info[281] : PlayerName : Martin Maldonado Name[0] : Martin Name[1] : Maldonado TeamShort : KCR Position : ['C'] Salary : 2700.0 FanPoints : 5.68 player_info[282] : PlayerName : Miguel Cabrera Name[0] : Miguel Name[1] : Cabrera TeamShort : DET Position : ['1B'] Salary : 2400.0 FanPoints : 6.92
##################################################### def getAllMLBPlayerInfo(VENDOR='FD'): conn = mysql.connector.connect(user='xxxx', password='xxxx', host='192.168.1.248', database='MLB_TABLE') cur = conn.cursor()
########################################################