Skip to content

Commit 097322f

Browse files
authored
CLN: FIXMEs (#44771)
1 parent e6f0d1d commit 097322f

File tree

17 files changed

+86
-113
lines changed

17 files changed

+86
-113
lines changed

pandas/_config/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,6 @@ def _warn_if_deprecated(key: str) -> bool:
642642
d = _get_deprecated_option(key)
643643
if d:
644644
if d.msg:
645-
print(d.msg)
646645
warnings.warn(d.msg, FutureWarning)
647646
else:
648647
msg = f"'{key}' is deprecated"

pandas/core/generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6024,7 +6024,7 @@ def _convert(
60246024
timedelta: bool_t = False,
60256025
) -> NDFrameT:
60266026
"""
6027-
Attempt to infer better dtype for object columns
6027+
Attempt to infer better dtype for object columns.
60286028
60296029
Parameters
60306030
----------

pandas/core/indexes/datetimes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,8 @@ def get_loc(self, key, method=None, tolerance=None):
647647
try:
648648
key = self._maybe_cast_for_get_loc(key)
649649
except ValueError as err:
650-
# FIXME: we get here because parse_with_reso doesn't raise on "t2m"
650+
# FIXME(dateutil#1180): we get here because parse_with_reso
651+
# doesn't raise on "t2m"
651652
raise KeyError(key) from err
652653

653654
elif isinstance(key, timedelta):

pandas/core/internals/blocks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,9 +1797,7 @@ def fillna(
17971797
value, limit, inplace, downcast
17981798
)
17991799

1800-
values = self.values
1801-
values = values if inplace else values.copy()
1802-
new_values = values.fillna(value=value, limit=limit)
1800+
new_values = self.values.fillna(value=value, limit=limit)
18031801
return [self.make_block_same_class(values=new_values)]
18041802

18051803

pandas/core/internals/concat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,6 @@ def _get_empty_dtype(join_units: Sequence[JoinUnit]) -> DtypeObj:
528528
return blk.dtype
529529

530530
if _is_uniform_reindex(join_units):
531-
# FIXME: integrate property
532531
empty_dtype = join_units[0].block.dtype
533532
return empty_dtype
534533

pandas/io/clipboard/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ def determine_clipboard():
518518
"cygwin" in platform.system().lower()
519519
): # Cygwin has a variety of values returned by platform.system(),
520520
# such as 'CYGWIN_NT-6.1'
521-
# FIXME: pyperclip currently does not support Cygwin,
521+
# FIXME(pyperclip#55): pyperclip currently does not support Cygwin,
522522
# see https://github.com/asweigart/pyperclip/issues/55
523523
if os.path.exists("/dev/clipboard"):
524524
warnings.warn(

pandas/tests/arrays/floating/test_construction.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ def test_floating_array_disallows_float16(request):
5656
with pytest.raises(TypeError, match=msg):
5757
FloatingArray(arr, mask)
5858

59-
if not np_version_under1p19:
60-
# Troubleshoot
61-
# https://github.com/numpy/numpy/issues/20512#issuecomment-985807740
62-
lowered = np.core._type_aliases.english_lower("Float16")
63-
assert lowered == "float16", lowered
64-
6559
if np_version_under1p19 or (
6660
locale.getlocale()[0] != "en_US" and not is_platform_windows()
6761
):

pandas/tests/extension/base/getitem.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pytest
33

44
import pandas as pd
5+
import pandas._testing as tm
56
from pandas.tests.extension.base.base import BaseExtensionTests
67

78

@@ -258,12 +259,22 @@ def test_getitem_integer_with_missing_raises(self, data, idx):
258259
with pytest.raises(ValueError, match=msg):
259260
data[idx]
260261

261-
# FIXME: dont leave commented-out
262+
@pytest.mark.xfail(
263+
reason="Tries label-based and raises KeyError; "
264+
"in some cases raises when calling np.asarray"
265+
)
266+
@pytest.mark.parametrize(
267+
"idx",
268+
[[0, 1, 2, pd.NA], pd.array([0, 1, 2, pd.NA], dtype="Int64")],
269+
ids=["list", "integer-array"],
270+
)
271+
def test_getitem_series_integer_with_missing_raises(self, data, idx):
272+
msg = "Cannot index with an integer indexer containing NA values"
262273
# TODO: this raises KeyError about labels not found (it tries label-based)
263-
# import pandas._testing as tm
264-
# ser = pd.Series(data, index=[tm.rands(4) for _ in range(len(data))])
265-
# with pytest.raises(ValueError, match=msg):
266-
# ser[idx]
274+
275+
ser = pd.Series(data, index=[tm.rands(4) for _ in range(len(data))])
276+
with pytest.raises(ValueError, match=msg):
277+
ser[idx]
267278

268279
def test_getitem_slice(self, data):
269280
# getitem[slice] should return an array

pandas/tests/indexes/multi/test_setops.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,24 @@ def test_union(idx, sort):
260260
else:
261261
assert result.equals(idx)
262262

263-
# FIXME: don't leave commented-out
264-
# not valid for python 3
265-
# def test_union_with_regular_index(self):
266-
# other = Index(['A', 'B', 'C'])
267263

268-
# result = other.union(idx)
269-
# assert ('foo', 'one') in result
270-
# assert 'B' in result
264+
@pytest.mark.xfail(
265+
# This test was commented out from Oct 2011 to Dec 2021, may no longer
266+
# be relevant.
267+
reason="Length of names must match number of levels in MultiIndex",
268+
raises=ValueError,
269+
)
270+
def test_union_with_regular_index(idx):
271+
other = Index(["A", "B", "C"])
271272

272-
# result2 = _index.union(other)
273-
# assert result.equals(result2)
273+
result = other.union(idx)
274+
assert ("foo", "one") in result
275+
assert "B" in result
276+
277+
msg = "The values in the array are unorderable"
278+
with tm.assert_produces_warning(RuntimeWarning, match=msg):
279+
result2 = idx.union(other)
280+
assert result.equals(result2)
274281

275282

276283
def test_intersection(idx, sort):
@@ -355,6 +362,7 @@ def test_union_sort_other_empty(slice_):
355362
other = idx[slice_]
356363
tm.assert_index_equal(idx.union(other), idx)
357364
# MultiIndex does not special case empty.union(idx)
365+
# FIXME: don't leave commented-out
358366
# tm.assert_index_equal(other.union(idx), idx)
359367

360368
# sort=False

pandas/tests/indexes/period/test_indexing.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -193,20 +193,18 @@ def test_getitem_seconds(self):
193193
"2013/02/01 9H",
194194
"2013/02/01 09:00",
195195
]
196-
for v in values:
196+
for val in values:
197197
# GH7116
198198
# these show deprecations as we are trying
199199
# to slice with non-integer indexers
200-
# FIXME: don't leave commented-out
201-
# with pytest.raises(IndexError):
202-
# idx[v]
203-
continue
200+
with pytest.raises(IndexError, match="only integers, slices"):
201+
idx[val]
204202

205-
s = Series(np.random.rand(len(idx)), index=idx)
206-
tm.assert_series_equal(s["2013/01/01 10:00"], s[3600:3660])
207-
tm.assert_series_equal(s["2013/01/01 9H"], s[:3600])
203+
ser = Series(np.random.rand(len(idx)), index=idx)
204+
tm.assert_series_equal(ser["2013/01/01 10:00"], ser[3600:3660])
205+
tm.assert_series_equal(ser["2013/01/01 9H"], ser[:3600])
208206
for d in ["2013/01/01", "2013/01", "2013"]:
209-
tm.assert_series_equal(s[d], s)
207+
tm.assert_series_equal(ser[d], ser)
210208

211209
def test_getitem_day(self):
212210
# GH#6716
@@ -223,24 +221,23 @@ def test_getitem_day(self):
223221
"2013/02/01 9H",
224222
"2013/02/01 09:00",
225223
]
226-
for v in values:
224+
for val in values:
227225

228226
# GH7116
229227
# these show deprecations as we are trying
230228
# to slice with non-integer indexers
231-
# with pytest.raises(IndexError):
232-
# idx[v]
233-
continue
229+
with pytest.raises(IndexError, match="only integers, slices"):
230+
idx[val]
234231

235-
s = Series(np.random.rand(len(idx)), index=idx)
236-
tm.assert_series_equal(s["2013/01"], s[0:31])
237-
tm.assert_series_equal(s["2013/02"], s[31:59])
238-
tm.assert_series_equal(s["2014"], s[365:])
232+
ser = Series(np.random.rand(len(idx)), index=idx)
233+
tm.assert_series_equal(ser["2013/01"], ser[0:31])
234+
tm.assert_series_equal(ser["2013/02"], ser[31:59])
235+
tm.assert_series_equal(ser["2014"], ser[365:])
239236

240237
invalid = ["2013/02/01 9H", "2013/02/01 09:00"]
241-
for v in invalid:
242-
with pytest.raises(KeyError, match=v):
243-
s[v]
238+
for val in invalid:
239+
with pytest.raises(KeyError, match=val):
240+
ser[val]
244241

245242

246243
class TestGetLoc:

0 commit comments

Comments
 (0)