Skip to content

Commit

Permalink
Fixes #237
Browse files Browse the repository at this point in the history
  • Loading branch information
sunt05 committed Nov 21, 2023
1 parent 55e9ea5 commit 595f168
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/supy/supy/_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,16 @@ def flatten_col(df_state: pd.DataFrame):

# upgrade df_state from earlier versions of SuPy
def upgrade_df_state(df_state: pd.DataFrame) -> pd.DataFrame:
"""
Upgrades the input DataFrame `df_state` if it contains deprecated columns.
If the DataFrame is already up to date, it returns a copy of the input DataFrame.
Parameters:
- df_state (pd.DataFrame): The DataFrame to be upgraded.
Returns:
- pd.DataFrame: The upgraded DataFrame if it contains deprecated columns, otherwise a copy of the input DataFrame.
"""
df_state_deprecated = df_state.copy()
df_state_deprecated.columns = df_state_deprecated.columns.remove_unused_levels()

Expand Down

0 comments on commit 595f168

Please sign in to comment.