Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Dec 13, 2024
1 parent e559a1b commit ee46751
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion pandas/core/arrays/arrow/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2160,7 +2160,9 @@ def interpolate(
"""
# NB: we return type(self) even if copy=False
if not self.dtype._is_numeric:
raise ValueError("Values must be numeric.")
raise NotImplementedError(
f"interpolate is not implemented for dtype={self.dtype}"
)

if (
not pa_version_under13p0
Expand Down
4 changes: 0 additions & 4 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6273,10 +6273,6 @@ class max type
else:
to_insert = ((self.index, None),)

if len(new_obj.columns) == 0 and names:
target_dtype = Index(names).dtype
new_obj.columns = new_obj.columns.astype(target_dtype)

multi_col = isinstance(self.columns, MultiIndex)
for j, (lev, lab) in enumerate(to_insert, start=1):
i = self.index.nlevels - j
Expand Down
2 changes: 0 additions & 2 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2361,6 +2361,4 @@ def external_values(values: ArrayLike) -> ArrayLike:
values.flags.writeable = False

# TODO(CoW) we should also mark our ExtensionArrays as read-only
if isinstance(values, ExtensionArray):
... # this is why test_to_dict_of_blocks_item_cache fails
return values
10 changes: 9 additions & 1 deletion pandas/tests/frame/methods/test_astype.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,15 @@ def test_astype_dt64_to_string(
item = item.iloc[0]
if using_infer_string:
assert item is pd.NA
else:

# Check that Series/DataFrame.astype matches DatetimeArray.astype
expected = frame_or_series(dta.astype("str"))
tm.assert_equal(result, expected)

item = result.iloc[0]
if frame_or_series is DataFrame:
item = item.iloc[0]
if using_infer_string:
assert item is np.nan

def test_astype_td64_to_string(self, frame_or_series):
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_combine_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_combine_first_mixed(self):
combined = f.combine_first(g)
tm.assert_frame_equal(combined, exp)

def test_combine_first(self, float_frame, using_infer_string):
def test_combine_first(self, float_frame):
# disjoint
head, tail = float_frame[:5], float_frame[5:]

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,5 @@ def test_frame_apply_np_array_return_type(self, using_infer_string):
# GH 35517
df = DataFrame([["foo"]])
result = df.apply(lambda col: np.array("bar"))
expected = Series(np.array(["bar"]), dtype=object)
expected = Series(np.array("bar"))
tm.assert_series_equal(result, expected)

0 comments on commit ee46751

Please sign in to comment.