Skip to content

Commit ba27811

Browse files
committed
fix namespace usage
1 parent 7c50a76 commit ba27811

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pandas/core/indexes/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6209,10 +6209,10 @@ def _maybe_downcast_for_indexing(self, other: Index) -> tuple[Index, Index]:
62096209
# let's instead try with a straight Index
62106210
self = Index(self._values)
62116211

6212-
elif self.inferred_type == 'string' and isinstance(other, ABCPeriodIndex):
6212+
elif self.inferred_type == "string" and isinstance(other, ABCPeriodIndex):
62136213
try:
62146214
return self.astype(other.dtype), other
6215-
except:
6215+
except (TypeError, ValueError):
62166216
return self, other
62176217

62186218
if not is_object_dtype(self.dtype) and is_object_dtype(other.dtype):

pandas/tests/indexes/period/test_setops.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,15 @@ def test_difference(self, sort):
316316

317317
def test_difference_mismatched_dtypes(self, sort):
318318
# GH58971
319-
index = period_range('2022-01-01', periods=5, freq='M')
320-
other = Index(['2022-02', '2022-03'])
319+
index = period_range("2022-01-01", periods=5, freq="M")
320+
other = pd.Index(["2022-02", "2022-03"])
321321

322322
idx_diff = index.difference(other, sort)
323-
expected = PeriodIndex(['2022-01', '2022-04', '2022-05'], freq='M')
323+
expected = PeriodIndex(["2022-01", "2022-04", "2022-05"], freq="M")
324324
tm.assert_index_equal(idx_diff, expected)
325325

326326
idx_diff = other.difference(index, sort)
327-
expected = Index([])
327+
expected = pd.Index([])
328328
tm.assert_index_equal(idx_diff, expected)
329329

330330
def test_difference_freq(self, sort):

0 commit comments

Comments
 (0)