Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbrn committed Jul 26, 2024
1 parent e6ddb46 commit b8bcf1c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/nested_pandas/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def count_nested(df, nested, by=None, join=True) -> NestedFrame:

if by is None:
field_to_len = df[nested].nest.fields[0]
counts = (
df[nested].nest.to_lists().apply(lambda x: len(x[field_to_len]), axis=1)
)
counts = df[nested].nest.to_lists().apply(lambda x: len(x[field_to_len]), axis=1)
counts.name = f"n_{nested}" # update name directly (rename causes issues downstream)
else:
# this may be able to be sped up using tolists() as well
Expand Down

0 comments on commit b8bcf1c

Please sign in to comment.