Skip to content

Commit

Permalink
Format black
Browse files Browse the repository at this point in the history
  • Loading branch information
pyiron-runner committed Oct 9, 2023
1 parent 709a767 commit c814c39
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pyiron_base/storage/flattenedstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ def _internal_arrays(self) -> Tuple[str, ...]:
This exists mostly to support :meth:`.to_pandas()`.
"""
return (
'start_index',
'length',
"start_index",
"length",
)

def copy(self):
Expand Down Expand Up @@ -1064,12 +1064,14 @@ def to_pandas(self, explode=False, include_index=False) -> pd.DataFrame:
:class:`pandas.DataFrame`: table of array values
"""
arrays = self.list_arrays(only_user=True)
df = pd.DataFrame(
{a: self.get_array_ragged(a) for a in arrays}
)
df = pd.DataFrame({a: self.get_array_ragged(a) for a in arrays})
if explode:
elem_arrays = [a for a in arrays if self.has_array(a)["per"] == "element"]
df = df.explode(elem_arrays).infer_objects(copy=False).reset_index(drop=not include_index)
df = (
df.explode(elem_arrays)
.infer_objects(copy=False)
.reset_index(drop=not include_index)
)
return df


Expand Down

0 comments on commit c814c39

Please sign in to comment.