Skip to content

Commit 8c9323e

Browse files
committed
mypy, arraymanager fixups
1 parent 07d04cc commit 8c9323e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pandas/core/internals/array_manager.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,9 @@ def fast_xs(self, loc: int) -> SingleArrayManager:
758758
result = dtype.construct_array_type()._from_sequence(values, dtype=dtype)
759759
# for datetime64/timedelta64, the np.ndarray constructor cannot handle pd.NaT
760760
elif is_datetime64_ns_dtype(dtype):
761-
result = DatetimeArray._from_sequence(values, dtype=dtype)._data
761+
result = DatetimeArray._from_sequence(values, dtype=dtype)._ndarray
762762
elif is_timedelta64_ns_dtype(dtype):
763-
result = TimedeltaArray._from_sequence(values, dtype=dtype)._data
763+
result = TimedeltaArray._from_sequence(values, dtype=dtype)._ndarray
764764
else:
765765
result = np.array(values, dtype=dtype)
766766
return SingleArrayManager([result], [self._axes[1]])

pandas/core/ops/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
from __future__ import annotations
77

88
import operator
9-
from typing import TYPE_CHECKING
9+
from typing import (
10+
TYPE_CHECKING,
11+
cast,
12+
)
1013
import warnings
1114

1215
import numpy as np
@@ -423,6 +426,7 @@ def flex_arith_method_FRAME(op):
423426
@Appender(doc)
424427
def f(self, other, axis: Axis = "columns", level=None, fill_value=None):
425428
axis = self._get_axis_number(axis) if axis is not None else 1
429+
axis = cast(int, axis)
426430

427431
if should_reindex_frame_op(self, other, op, axis, fill_value, level):
428432
return frame_arith_method_with_reindex(self, other, op)

0 commit comments

Comments
 (0)