Skip to content

Commit

Permalink
Merge pull request #487 from gipert/flow
Browse files Browse the repository at this point in the history
Bug fix in `FileDB.from_disk()`
  • Loading branch information
gipert authored May 5, 2023
2 parents 491df43 + 973d1b1 commit a492e41
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pygama/flow/file_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,11 @@ def from_disk(self, path: str | list[str]) -> None:
# read in dataframe
df = pd.read_hdf(p, key="dataframe")

# first iteration
if _columns is None:
_columns = columns
_df = df
continue
elif _columns != columns:
log.debug("found inconsistent FileDB, trying to merge")
# if columns are not the same, need to merge the two dataframes
Expand All @@ -561,9 +563,9 @@ def _replace_idx(row, idx, new_idx, tier):
args=(idx, new_idx, tier),
axis=1,
)
else:
# if columns are the same, assume we can safely concat the dataframes
_df = pd.concat([_df, df], ignore_index=True, copy=False)

# now we can safely concat the dataframes
_df = pd.concat([_df, df], ignore_index=True, copy=False)

self.set_config(_cfg)
self.df = _df
Expand Down

0 comments on commit a492e41

Please sign in to comment.