Skip to content

Commit a17ca3a

Browse files
authored
CLN: TODOs and FIXMEs (#44683)
1 parent aee662a commit a17ca3a

File tree

10 files changed

+22
-64
lines changed

10 files changed

+22
-64
lines changed

pandas/_libs/tslibs/offsets.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,8 @@ cdef class Tick(SingleConstructorOffset):
928928
if util.is_timedelta64_object(other) or PyDelta_Check(other):
929929
return other + self.delta
930930
elif isinstance(other, type(self)):
931-
# TODO: this is reached in tests that specifically call apply,
931+
# TODO(2.0): remove once apply deprecation is enforced.
932+
# This is reached in tests that specifically call apply,
932933
# but should not be reached "naturally" because __add__ should
933934
# catch this case first.
934935
return type(self)(self.n + other.n)

pandas/core/frame.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@
214214
if TYPE_CHECKING:
215215

216216
from pandas.core.groupby.generic import DataFrameGroupBy
217+
from pandas.core.internals import SingleDataManager
217218
from pandas.core.resample import Resampler
218219

219220
from pandas.io.formats.style import Styler
@@ -3438,8 +3439,8 @@ def _ixs(self, i: int, axis: int = 0):
34383439
else:
34393440
label = self.columns[i]
34403441

3441-
values = self._mgr.iget(i)
3442-
result = self._box_col_values(values, i)
3442+
col_mgr = self._mgr.iget(i)
3443+
result = self._box_col_values(col_mgr, i)
34433444

34443445
# this is a cached value, mark it so
34453446
result._set_as_cached(label, self)
@@ -3902,7 +3903,7 @@ def _ensure_valid_index(self, value) -> None:
39023903

39033904
self._mgr = self._mgr.reindex_axis(index_copy, axis=1, fill_value=np.nan)
39043905

3905-
def _box_col_values(self, values, loc: int) -> Series:
3906+
def _box_col_values(self, values: SingleDataManager, loc: int) -> Series:
39063907
"""
39073908
Provide boxed values for a column.
39083909
"""
@@ -3927,8 +3928,8 @@ def _get_item_cache(self, item: Hashable) -> Series:
39273928
# pending resolution of GH#33047
39283929

39293930
loc = self.columns.get_loc(item)
3930-
values = self._mgr.iget(loc)
3931-
res = self._box_col_values(values, loc).__finalize__(self)
3931+
col_mgr = self._mgr.iget(loc)
3932+
res = self._box_col_values(col_mgr, loc).__finalize__(self)
39323933

39333934
cache[item] = res
39343935
res._set_as_cached(item, self)

pandas/core/indexes/numeric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def astype(self, dtype, copy=True):
249249
"values are required for conversion"
250250
)
251251
elif is_integer_dtype(dtype) and not is_extension_array_dtype(dtype):
252-
# TODO(jreback); this can change once we have an EA Index type
252+
# TODO(ExtensionIndex); this can change once we have an EA Index type
253253
# GH 13149
254254
arr = astype_nansafe(self._values, dtype=dtype)
255255
if isinstance(self, Float64Index):

pandas/io/json/_json.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,9 @@ def _convert_axes(self):
913913
def _try_convert_types(self):
914914
raise AbstractMethodError(self)
915915

916-
def _try_convert_data(self, name, data, use_dtypes=True, convert_dates=True):
916+
def _try_convert_data(
917+
self, name, data, use_dtypes: bool = True, convert_dates: bool = True
918+
):
917919
"""
918920
Try to parse a ndarray like into a column by inferring dtype.
919921
"""

pandas/tests/arrays/integer/test_function.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def test_value_counts_empty():
120120
# https://github.com/pandas-dev/pandas/issues/33317
121121
ser = pd.Series([], dtype="Int64")
122122
result = ser.value_counts()
123-
# TODO: The dtype of the index seems wrong (it's int64 for non-empty)
123+
# TODO(ExtensionIndex): The dtype of the index seems wrong
124+
# (it's int64 for non-empty)
124125
idx = pd.Index([], dtype="object")
125126
expected = pd.Series([], index=idx, dtype="Int64")
126127
tm.assert_series_equal(result, expected)

pandas/tests/base/test_conversion.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -193,26 +193,15 @@ def test_iter_box(self):
193193
pd.core.dtypes.dtypes.PeriodDtype("A-DEC"),
194194
),
195195
(pd.IntervalIndex.from_breaks([0, 1, 2]), IntervalArray, "interval"),
196-
# This test is currently failing for datetime64[ns] and timedelta64[ns].
197-
# The NumPy type system is sufficient for representing these types, so
198-
# we just use NumPy for Series / DataFrame columns of these types (so
199-
# we get consolidation and so on).
200-
# However, DatetimeIndex and TimedeltaIndex use the DateLikeArray
201-
# abstraction to for code reuse.
202-
# At the moment, we've judged that allowing this test to fail is more
203-
# practical that overriding Series._values to special case
204-
# Series[M8[ns]] and Series[m8[ns]] to return a DateLikeArray.
205-
pytest.param(
196+
(
206197
pd.DatetimeIndex(["2017", "2018"]),
207-
np.ndarray,
198+
DatetimeArray,
208199
"datetime64[ns]",
209-
marks=[pytest.mark.xfail(reason="datetime _values")],
210200
),
211-
pytest.param(
201+
(
212202
pd.TimedeltaIndex([10 ** 10]),
213-
np.ndarray,
203+
TimedeltaArray,
214204
"m8[ns]",
215-
marks=[pytest.mark.xfail(reason="timedelta _values")],
216205
),
217206
],
218207
)

pandas/tests/extension/base/reshaping.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import pandas as pd
77
from pandas.api.extensions import ExtensionArray
8-
from pandas.core.internals import ExtensionBlock
8+
from pandas.core.internals.blocks import EABackedBlock
99
from pandas.tests.extension.base.base import BaseExtensionTests
1010

1111

@@ -28,7 +28,7 @@ def test_concat(self, data, in_frame):
2828

2929
assert dtype == data.dtype
3030
if hasattr(result._mgr, "blocks"):
31-
assert isinstance(result._mgr.blocks[0], ExtensionBlock)
31+
assert isinstance(result._mgr.blocks[0], EABackedBlock)
3232
assert isinstance(result._mgr.arrays[0], ExtensionArray)
3333

3434
@pytest.mark.parametrize("in_frame", [True, False])

pandas/tests/frame/test_reductions.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,9 @@ def wrapper(x):
9393
tm.assert_series_equal(
9494
result0, frame.apply(wrapper), check_dtype=check_dtype, rtol=rtol, atol=atol
9595
)
96-
# FIXME: HACK: win32
9796
tm.assert_series_equal(
9897
result1,
9998
frame.apply(wrapper, axis=1),
100-
check_dtype=False,
10199
rtol=rtol,
102100
atol=atol,
103101
)
@@ -200,9 +198,7 @@ def wrapper(x):
200198
result1 = f(axis=1, skipna=False)
201199

202200
tm.assert_series_equal(result0, frame.apply(wrapper))
203-
tm.assert_series_equal(
204-
result1, frame.apply(wrapper, axis=1), check_dtype=False
205-
) # FIXME: HACK: win32
201+
tm.assert_series_equal(result1, frame.apply(wrapper, axis=1))
206202
else:
207203
skipna_wrapper = alternative
208204
wrapper = alternative

pandas/tests/plotting/frame/test_frame_color.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -659,36 +659,6 @@ def test_colors_of_columns_with_same_name(self):
659659

660660
def test_invalid_colormap(self):
661661
df = DataFrame(np.random.randn(3, 2), columns=["A", "B"])
662-
msg = (
663-
"'invalid_colormap' is not a valid value for name; supported values are "
664-
"'Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', "
665-
"'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', "
666-
"'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', "
667-
"'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', "
668-
"'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', "
669-
"'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', "
670-
"'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', "
671-
"'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', "
672-
"'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', "
673-
"'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Wistia', 'Wistia_r', "
674-
"'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', "
675-
"'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', "
676-
"'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', "
677-
"'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', "
678-
"'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', "
679-
"'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', "
680-
"'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', "
681-
"'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', "
682-
"'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', "
683-
"'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', "
684-
"'hsv_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', "
685-
"'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', "
686-
"'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', "
687-
"'rainbow_r', 'seismic', 'seismic_r', 'spring', 'spring_r', 'summer', "
688-
"'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', "
689-
"'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'turbo', "
690-
"'turbo_r', 'twilight', 'twilight_r', 'twilight_shifted', "
691-
"'twilight_shifted_r', 'viridis', 'viridis_r', 'winter', 'winter_r'"
692-
)
662+
msg = "'invalid_colormap' is not a valid value for name; supported values are "
693663
with pytest.raises(ValueError, match=msg):
694664
df.plot(colormap="invalid_colormap")

pandas/tests/reshape/concat/test_empty.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,12 @@ def test_concat_empty_series_dtypes_sparse(self):
197197
result = concat(
198198
[Series(dtype="float64").astype("Sparse"), Series(dtype="float64")]
199199
)
200-
# TODO: release-note: concat sparse dtype
201200
expected = pd.SparseDtype(np.float64)
202201
assert result.dtype == expected
203202

204203
result = concat(
205204
[Series(dtype="float64").astype("Sparse"), Series(dtype="object")]
206205
)
207-
# TODO: release-note: concat sparse dtype
208206
expected = pd.SparseDtype("object")
209207
assert result.dtype == expected
210208

0 commit comments

Comments
 (0)