You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem description:
It's difficult to determine how/when to use inplace or create a copy and the behavior is inconsistent. Does pandas_flavor always require a copy/modifying the original dataframe? Is there a way to avoid this in order to save memory?
importpandas_flavor# Does not replace original dataframe@pandas_flavor.register_dataframe_methoddefdrop_empty_rows(dataframe):
returndataframe.dropna(axis=0, how='all')
# Should replace original dataframe@pandas_flavor.register_dataframe_methoddefdrop_empty_rows(dataframe):
dataframe=dataframe.dropna(axis=0, how='all')
returndataframe# Should replace original dataframe@pandas_flavor.register_dataframe_methoddefdrop_empty_rows(dataframe):
dataframe_processed=dataframe.copy()
dataframe_processed=dataframe.dropna(axis=0, how='all')
returndataframe_processed
If I call the first function on a dataframe, it returns the dataframe with dropped rows but does not change the original dataframe.
@DOH-Manada pandas-flavor doesnt copy. It just provides a convenient interface. The real work is in pandas. you can also enable pandas copy on write which should take care of copy or not copy decisions for better memory performance
Problem description:
It's difficult to determine how/when to use inplace or create a copy and the behavior is inconsistent. Does pandas_flavor always require a copy/modifying the original dataframe? Is there a way to avoid this in order to save memory?
If I call the first function on a dataframe, it returns the dataframe with dropped rows but does not change the original dataframe.
This function returns the reduced dataframe, but doesn't affect the original dataframe.
The text was updated successfully, but these errors were encountered: