Skip to content

Commit dc20092

Browse files
committed
CLN (feedback): revert needs_i8_conversion if/else clause
1 parent 0086269 commit dc20092

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

pandas/core/frame.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
is_object_dtype,
115115
is_scalar,
116116
is_sequence,
117+
needs_i8_conversion,
117118
pandas_dtype,
118119
)
119120
from pandas.core.dtypes.missing import isna, notna
@@ -6368,11 +6369,23 @@ def combine_first(self, other: DataFrame) -> DataFrame:
63686369
"""
63696370
import pandas.core.computation.expressions as expressions
63706371

6372+
def extract_values(arr):
6373+
# get values if arr is Series or Index
6374+
arr = extract_array(arr, extract_numpy=True)
6375+
6376+
# convert datelike to i8
6377+
if needs_i8_conversion(arr.dtype):
6378+
if is_extension_array_dtype(arr.dtype):
6379+
arr = arr.asi8
6380+
else:
6381+
arr = arr.view("i8")
6382+
return arr
6383+
63716384
def combiner(x, y):
63726385
mask = extract_array(isna(x))
63736386

6374-
x_values = extract_array(x, to_numpy=True)
6375-
y_values = extract_array(y, to_numpy=True)
6387+
x_values = extract_values(x)
6388+
y_values = extract_values(y)
63766389

63776390
# If the column y in other DataFrame is not in first DataFrame,
63786391
# just return y_values.

0 commit comments

Comments
 (0)