-
-
Notifications
You must be signed in to change notification settings - Fork 141
allow multiindex for a column in DataFrame.loc #494
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 2 commits
c24eeb0
f5f5d60
fb51203
3417725
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ from pandas._typing import ( | |
) | ||
|
||
_IndexSliceTuple: TypeAlias = tuple[ | ||
Union[Index, MaskType, Scalar, list[ScalarT], slice], ... | ||
Union[Index, MaskType, Scalar, list[ScalarT], slice | tuple[ScalarT, ...]], ... | ||
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. Same here (I think we need it 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.
Yes, fixed in commit 3417725 |
||
] | ||
|
||
_IndexSliceUnion: TypeAlias = Union[slice, _IndexSliceTuple] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,7 @@ from typing_extensions import ( | |
) | ||
import xarray as xr | ||
|
||
from pandas._libs.interval import Interval | ||
from pandas._libs.missing import NAType | ||
from pandas._libs.tslibs import BaseOffset | ||
from pandas._typing import ( | ||
|
@@ -94,7 +95,6 @@ from pandas._typing import ( | |
IgnoreRaise, | ||
IndexingInt, | ||
IntervalClosedType, | ||
IntervalT, | ||
JoinHow, | ||
JsonSeriesOrient, | ||
Level, | ||
|
@@ -216,13 +216,43 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): | |
@overload | ||
def __new__( | ||
cls, | ||
data: IntervalIndex[IntervalT], | ||
data: IntervalIndex[Interval[int]], | ||
index: Axes | None = ..., | ||
dtype=..., | ||
name: Hashable | None = ..., | ||
copy: bool = ..., | ||
fastpath: bool = ..., | ||
) -> Series[IntervalT]: ... | ||
) -> Series[Interval[int]]: ... | ||
@overload | ||
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. would be nice to add the TODO again 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. Same issue - included the changes from the other PR, so I've reverted that here in commit fb51203 |
||
def __new__( | ||
cls, | ||
data: IntervalIndex[Interval[float]], | ||
index: Axes | None = ..., | ||
dtype=..., | ||
name: Hashable | None = ..., | ||
copy: bool = ..., | ||
fastpath: bool = ..., | ||
) -> Series[Interval[float]]: ... | ||
@overload | ||
def __new__( | ||
cls, | ||
data: IntervalIndex[Interval[Timestamp]], | ||
index: Axes | None = ..., | ||
dtype=..., | ||
name: Hashable | None = ..., | ||
copy: bool = ..., | ||
fastpath: bool = ..., | ||
) -> Series[Interval[Timestamp]]: ... | ||
@overload | ||
def __new__( | ||
cls, | ||
data: IntervalIndex[Interval[Timedelta]], | ||
index: Axes | None = ..., | ||
dtype=..., | ||
name: Hashable | None = ..., | ||
copy: bool = ..., | ||
fastpath: bool = ..., | ||
) -> Series[Interval[Timedelta]]: ... | ||
@overload | ||
def __new__( | ||
cls, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would
Scalar
also work here instead ofScalarT
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, seems so. Fixed in commit 3417725