Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c2f575c

Browse files
committedAug 13, 2024·
fix warning
1 parent 1a37e0e commit c2f575c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
 

‎pandas/core/generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import annotations
33

44
import collections
5+
import collections.abc
56
from copy import deepcopy
67
import datetime as dt
78
from functools import partial
@@ -16,7 +17,6 @@
1617
ClassVar,
1718
Literal,
1819
NoReturn,
19-
Sequence,
2020
cast,
2121
final,
2222
overload,
@@ -4127,7 +4127,7 @@ class animal locomotion
41274127
index = self.index
41284128

41294129
if isinstance(index, MultiIndex):
4130-
level = range(len(key)) if isinstance(key, Sequence) else 0
4130+
level = range(len(key)) if isinstance(key, collections.abc.Sequence) else 0
41314131
loc, new_index = index.get_loc_level(
41324132
key,
41334133
level=level,

‎pandas/tests/series/indexing/test_xs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ def test_xs_key_as_list(self):
8484

8585
def test_xs_default_level(self):
8686
# GH#59098
87-
df = DataFrame(dict(i=[1,2,3], j=[1,1,2], x=[10, 100, 1000])).set_index(["i", "j"])
87+
df = DataFrame(
88+
{"i": [1,2,3], "j": [1,1,2], "x": [10, 100, 1000]}
89+
).set_index(["i", "j"])
8890
key = (1, 1)
8991

9092
# Both scenarios should return DataFrame

0 commit comments

Comments
 (0)
Please sign in to comment.