Skip to content

BUG - False drops groupings #58361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1628,9 +1628,8 @@ def isocalendar(self) -> DataFrame:

See Also
--------
DatetimeIndex.day: The day of the datetime.
DatetimeIndex.minute: The minutes of the datetime.
DatetimeIndex.second: The seconds of the datetime.
Series.dt.minute : Minutes of the datetime.
Series.dt.second : Seconds of the datetime.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you split this PR into 2 separate parts?
I.E. let this PR fix the bug, and make a new PR for improving the docstrings

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will do.


Examples
--------
Expand Down
7 changes: 6 additions & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Sequence,
)
import functools
import pandas as pd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this import, line 181 imports Series already

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

from inspect import signature
from io import StringIO
import itertools
Expand Down Expand Up @@ -2865,7 +2866,8 @@ def to_parquet(

Returns
-------
bytes if no path argument is provided else None
bytes or None
If no `path` argument is provided, returns the bytes representation of the DataFrame written in the Parquet format. If a `path` argument is provided, returns None.

See Also
--------
Expand Down Expand Up @@ -8985,6 +8987,9 @@ def groupby(
if level is None and by is None:
raise TypeError("You have to supply one of 'by' and 'level'")

if not as_index and isinstance(by, pd.Series) and by.name in self.columns:
raise ValueError(f"cannot insert {by.name}, already exists")

return DataFrameGroupBy(
obj=self,
keys=by,
Expand Down
Loading