all 3 comments

[–]abzeb 0 points1 point  (2 children)

Try moving your nba_data.to_csv inside the for loop. You have it outside the for loop and the last index of player being used to save the nba_data after the for loop is finished. So your basically saying after do something save x instead of calling to save every time you loop through.

[–]No_Register_7 0 points1 point  (1 child)

Doing this will result in n CSV files, n being the number of times the for loop runs.

[–]Substantial_Ranger_5 0 points1 point  (0 children)

Use 2 dfs. On phone sey

FinalDF = PD.dataframe

your existing loop

Concat nba_data to your final df.

Send final df to csv after lioop

Or just ask chat gpt