-
-
Notifications
You must be signed in to change notification settings - Fork 143
add proper type when grouping by a Series #708
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
Changes from 4 commits
ac92a2f
413f08d
4eeb52a
b984743
903b662
8d692fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -427,12 +427,30 @@ ByT = TypeVar( | |
Interval[Timedelta], | ||
tuple, | ||
) | ||
# Use a distinct SeriesByT when using groupby with Series of known dtype. | ||
# Essentially, an intersection between Series S1 TypeVar, and ByT TypeVar | ||
SeriesByT = TypeVar( | ||
"SeriesByT", | ||
str, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've been recently advised to no longer use constrained There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, What is the difference between I tried to replace the SeriesByT with the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
You probably also need to adjust the type used for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks I actually tried that and got rid of the errors. |
||
bytes, | ||
datetime.date, | ||
bool, | ||
int, | ||
float, | ||
complex, | ||
Timestamp, | ||
Timedelta, | ||
Period, | ||
Interval[int], | ||
Interval[float], | ||
Interval[Timestamp], | ||
Interval[Timedelta], | ||
) | ||
GroupByObjectNonScalar: TypeAlias = ( | ||
tuple | ||
| list[_HashableTa] | ||
| Function | ||
| list[Function] | ||
| Series | ||
| list[Series] | ||
| np.ndarray | ||
| list[np.ndarray] | ||
|
@@ -442,7 +460,7 @@ GroupByObjectNonScalar: TypeAlias = ( | |
| Grouper | ||
| list[Grouper] | ||
) | ||
GroupByObject: TypeAlias = Scalar | Index | GroupByObjectNonScalar | ||
GroupByObject: TypeAlias = Scalar | Index | GroupByObjectNonScalar | Series | ||
|
||
StataDateFormat: TypeAlias = Literal[ | ||
"tc", | ||
|
Uh oh!
There was an error while loading. Please reload this page.