Skip to content

Commit

Permalink
ENH: Use context manager to suppress nan-categorical warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Ana Ruelas committed Jun 2, 2017
1 parent 69d1269 commit 6b19e45
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions zipline/utils/pandas_utils.py
Expand Up @@ -258,10 +258,11 @@ def categorical_df_concat(df_list, inplace=False):
new_categories = sorted(
set().union(
*(frame[col].cat.categories for frame in df_list)
) - {None}
)
)

for df in df_list:
df[col].cat.set_categories(new_categories, inplace=True)
with ignore_pandas_nan_categorical_warning():
for df in df_list:
df[col].cat.set_categories(new_categories, inplace=True)

return pd.concat(df_list)

0 comments on commit 6b19e45

Please sign in to comment.