Skip to content

Commit

Permalink
Fix logic of safe concat method
Browse files Browse the repository at this point in the history
  • Loading branch information
willGraham01 committed Oct 26, 2023
1 parent 2939283 commit 5551354
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/brainreg/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ def safe_pandas_concat(df1: pd.DataFrame, df2: pd.DataFrame) -> pd.DataFrame:
:param df2: DataFrame to concatenate.
:returns: DataFrame formed from concatenation of df1 and df2.
"""
if df1.empty:
if df1.empty and df2.empty:
return pd.DataFrame(columns=df1.columns)
elif df1.empty:
return df2.copy()
elif df2.empty:
return df1.copy()
elif df1.empty and df2.empty:
return pd.DataFrame(columns=df1.columns)
else:
return pd.concat([df1, df2], ignore_index=True)

0 comments on commit 5551354

Please sign in to comment.