Skip to content

Commit

Permalink
dict meta through series
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbrn committed Sep 27, 2024
1 parent e8074ff commit ccdf5f4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/nested_dask/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@ def reduce(self, func, *args, meta=None, **kwargs) -> NestedFrame:
# Handle meta shorthands to produce nestedframe output
# route standard dict meta to nestedframe
if isinstance(meta, dict):
meta = npd.NestedFrame(meta, index=[])
series_dict = {item[0]: pd.Series(dtype=item[1]) for item in meta.items()}
meta = npd.NestedFrame(series_dict)
# reroute series meta to nestedframe, per consistency with nested-pandas
elif isinstance(meta, tuple) and len(meta) == 2: # len 2 to only try on proper series meta
meta = npd.NestedFrame(pd.Series(name=meta[0], dtype=meta[1]).to_frame())
Expand Down

0 comments on commit ccdf5f4

Please sign in to comment.