Skip to content

Commit

Permalink
code formatting tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzoic committed Oct 18, 2023
1 parent ebbde41 commit 8056b2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions countess/plugins/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ def process(self, data: pd.DataFrame, source: str, logger: Logger):
# I've set "index=True" below to emit the indexes

drop_index = data.index.name is None and data.index.names[0] is None
dataframe = flatten_columns(
data.reset_index(drop=drop_index)
)
dataframe = flatten_columns(data.reset_index(drop=drop_index))

# if this is our first dataframe to write then decide whether to
# include the header or not.
Expand Down
5 changes: 2 additions & 3 deletions countess/utils/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ def flatten_columns(dataframe: pd.DataFrame, inplace: bool = False) -> pd.DataFr
dataframe = dataframe.copy()

dataframe.columns = [
"__".join(a) if type(a) is tuple else a
for a in dataframe.columns.to_flat_index()
] # type: ignore [assignment]
"__".join(a) if type(a) is tuple else a for a in dataframe.columns.to_flat_index()
] # type: ignore [assignment]

return dataframe

0 comments on commit 8056b2b

Please sign in to comment.