nflverse / nfl_data_py

Python code for working with NFL play by play data.
MIT License
252 stars 48 forks source link

import_weekly_data returns shortened list #72

Closed lukastheblack closed 11 months ago

lukastheblack commented 11 months ago

I am trying to get a list of player ids with name and position. When I use the following

player = nfl.import_weekly_data([2023], ['player_id', 'player_name','position'],downcast=False) print(player)

It outputs

   player_id   player_name position

0 00-0023459 A.Rodgers QB 1 00-0024243 M.Lewis TE 2 00-0026498 M.Stafford QB 3 00-0026498 M.Stafford QB 4 00-0026498 M.Stafford QB ... ... ... ... 1235 00-0039164 A.Richardson QB 1236 00-0039164 A.Richardson QB 1237 00-0039165 Z.Charbonnet RB 1238 00-0039165 Z.Charbonnet RB 1239 00-0039165 Z.Charbonnet RB

I would like to output all 1239( Rather ALL) Player IDs with stats to a file. I didn't see any other issues reported so I Know I'm doing something wrong, can anyone point me in the right direction?

alecglen commented 11 months ago

Hey @lukastheblack! Guessing you got this figured out?

Just in case: The print-out truncates it for readability, but the full dataset is still there in the player object (a Pandas dataframe). You can write it to a file using your choice of Pandas methods, for example player.to_csv("players.csv").

lukastheblack commented 11 months ago

@alecglen Hey! I ended up adding an "pandas.set_option('display.max_rows', None)" to the function , but I appreciate your example. Long term I don't want to print it to stout, it would go to a database. I just like to SEE it when I start prototyping. Thank you for the response!