kyleskom / NBA-Machine-Learning-Sports-Betting

NBA sports betting using machine learning
1.13k stars 425 forks source link

Please, help me guys #403

Closed HyakuzaO closed 5 months ago

HyakuzaO commented 5 months ago

error

Please guys, i tried everything, ask for help on chatgpt but its useless, can anyone please help me do this working guys? i would love run that script but i try everything but i cant.. please someone help me . im a rookie . ty for all that could help me guys

Scandianis commented 5 months ago

Did you try this? It is working for me:

Adding the following on line 37 in Create_Games.py:

if home_team not in ['Eastern']:

Adjust margin of course for the following code.

Final look:

...

for row in odds_df.itertuples(): home_team = row[3] away_team = row[4] if home_team not in ['Eastern']:

    date = row[2]
    date_array = date.split('-')
    if not date_array or len(date_array) < 2:
        continue
    year = date_array[0] + '-' + date_array[1]
    month = date_array[2][:2]
    day = date_array[2][2:]

...

HyakuzaO commented 5 months ago

Line 34: home_team = row[3] Line 35: away_team = row[4] Line 36: Line 37: if home_team not in ['Eastern']: Line 38: date = row[2] Line 39: date_array = date.split('-') Line 40: if not date_array or len(date_array) < 2: Line 41: continue

... Restante do código que processa a data e outras operações ...

Like this bro?

Scandianis commented 5 months ago

image

HyakuzaO commented 5 months ago

Will try, aprecciate your help bro, can you give your email bro?

HyakuzaO commented 5 months ago

imagem after doing that now i have this error :(

HyakuzaO commented 5 months ago

anybody have ideas please?

Scandianis commented 5 months ago

Did you run these first?

Get_Data.py

Get_Odds_Data.py

HyakuzaO commented 5 months ago

yes, i run it but still have same problem, i dont know what to do more :(

HyakuzaO commented 5 months ago

imagem i put the code just like you said

Scandianis commented 5 months ago

And the further down it is like this?

image

HyakuzaO commented 5 months ago

that part is moded as well? im a rookie in this, i just wanna run that machine learning, 4 days trying and getting always that error. could you paste here or send to me that create_games.py already modified? please, and sorry for any inconvinience but i dont know more what to do :(

HyakuzaO commented 5 months ago

imagem

Scandianis commented 5 months ago

Here is the file. Rename from txt to py. Create_Games.txt

HyakuzaO commented 5 months ago

i will try, many thanks

HyakuzaO commented 5 months ago

@Scandianis now its reach 100% ... many thanks, now will try next steps

HyakuzaO commented 5 months ago

Many thanks to all that helped me , special to @Scandianis . Cheers bros

mohcly commented 4 months ago

hello guys, please I tried everything you says but ended up with this error: "Traceback (most recent call last): File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Users/mohamedcoulibaly/Desktop/NBA-Machine-Learning-Sports-Betting/src/Process-Data/Create_Games.py", line 60, in team_df = pd.read_sqlquery(f"select * from \"teams{year}-{month}-{day}\"", teams_con, index_col="index") File "/Users/mohamedcoulibaly/Desktop/NBA-Machine-Learning-Sports-Betting/venv/lib/python3.9/site-packages/pandas/io/sql.py", line 486, in read_sql_query return pandas_sql.read_query( File "/Users/mohamedcoulibaly/Desktop/NBA-Machine-Learning-Sports-Betting/venv/lib/python3.9/site-packages/pandas/io/sql.py", line 2328, in read_query cursor = self.execute(sql, params) File "/Users/mohamedcoulibaly/Desktop/NBA-Machine-Learning-Sports-Betting/venv/lib/python3.9/site-packages/pandas/io/sql.py", line 2276, in execute raise ex from exc pandas.errors.DatabaseError: Execution failed on sql 'select * from "teams_2023-24-3-1"': no such table: teams_2023-24-3-1 (venv) (base) mohamedcoulibaly@Mohameds-MacBook-Air Process-Data % "

Scandianis commented 4 months ago

Solved here:

https://github.com/kyleskom/NBA-Machine-Learning-Sports-Betting/issues/412

HyakuzaO commented 4 months ago

412

mohcly commented 4 months ago

thanks guys, I'm checking it

mohcly commented 4 months ago

problem solved thanks a lot.

mohcly commented 4 months ago

@Scandianis please I have this problem sometimes, I comes a goes by his own, do you know how to solve this? " File "/Users/mohamedcoulibaly/Desktop/NBA-Machine-Learning-Sports-Betting/main.py", line 142, in main() File "/Users/mohamedcoulibaly/Desktop/NBA-Machine-Learning-Sports-Betting/main.py", line 122, in main XGBoost_Runner.xgb_runner(data, todays_games_uo, frame_ml, games, home_team_odds, away_team_odds, args.kc) File "/Users/mohamedcoulibaly/Desktop/NBA-Machine-Learning-Sports-Betting/src/Predict/XGBoost_Runner.py", line 89, in xgb_runner bankroll_fraction_home = bankroll_descriptor + str(kc.calculate_kelly_criterion(home_team_odds[count], ml_predictions_array[count][0][1])) + '%' File "/Users/mohamedcoulibaly/Desktop/NBA-Machine-Learning-Sports-Betting/src/Utils/Kelly_Criterion.py", line 15, in calculate_kelly_criterion decimal_odds = american_to_decimal(american_odds) File "/Users/mohamedcoulibaly/Desktop/NBA-Machine-Learning-Sports-Betting/src/Utils/Kelly_Criterion.py", line 5, in american_to_decimal if american_odds >= 100: TypeError: '>=' not supported between instances of 'NoneType' and 'int' (venv) (base) mohamedcoulibaly@Mohameds-MacBook-Air NBA-Machine-Learning-Sports-Betting % "

Scandianis commented 4 months ago

The above has been working two months for me.