Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperdff authored Aug 2, 2021
1 parent 999c416 commit 25b0a4d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions nfl_data_py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ def import_pbp_data(years, columns=None, downcast=True):
years (List[int]): years to get PBP data for
columns (List[str]): only return these columns
downcast (bool): convert float64 to float32, default True
Returns:
DataFrame
"""
if not isinstance(years, (list, range)):
raise ValueError('Input must be list or range.')
Expand Down Expand Up @@ -54,6 +52,7 @@ def import_pbp_data(years, columns=None, downcast=True):

# converts float64 to float32, saves ~30% memory
if downcast:
print('Downcasting floats.')
cols = plays.select_dtypes(include=[numpy.float64]).columns
plays.loc[:, cols] = plays.loc[:, cols].astype(numpy.float32)

Expand All @@ -67,10 +66,8 @@ def import_weekly_data(years, columns=None, downcast=True):
years (List[int]): years to get PBP data for
columns (List[str]): only return these columns
downcast (bool): convert float64 to float32, default True
Returns:
DataFrame
"""
if not isinstance(years, (list, range)):
raise ValueError('Input must be list or range.')
Expand All @@ -89,6 +86,7 @@ def import_weekly_data(years, columns=None, downcast=True):

# converts float64 to float32, saves ~30% memory
if downcast:
print('Downcasting floats.')
cols = data.select_dtypes(include=[numpy.float64]).columns
data.loc[:, cols] = data.loc[:, cols].astype(numpy.float32)

Expand Down

0 comments on commit 25b0a4d

Please sign in to comment.