Skip to content

Commit

Permalink
Merge pull request #24 from MMuta52/main
Browse files Browse the repository at this point in the history
Updating pandas concat syntax
  • Loading branch information
cooperdff authored Jul 30, 2022
2 parents 04cf18e + 20cda88 commit 7e6e342
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions nfl_data_py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def import_pbp_data(years, columns=None, downcast=True, cache=False, alt_path=No
appauthor = 'cooper_dff'

plays = pandas.DataFrame()
pbp_data = []

if cache is True:

Expand Down Expand Up @@ -109,16 +110,16 @@ def import_pbp_data(years, columns=None, downcast=True, cache=False, alt_path=No
raw = pandas.DataFrame(data)
raw['season'] = year

if len(plays) == 0:
plays = raw
else:
plays = plays.append(raw)
pbp_data.append(raw)

print(str(year) + ' done.')

except:
print('Data not available for ' + str(year))

if len(pbp_data) > 0:
plays = pandas.concat(pbp_data).reset_index(drop=True)

# converts float64 to float32, saves ~30% memory
if downcast:
print('Downcasting floats.')
Expand Down

0 comments on commit 7e6e342

Please sign in to comment.