We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3a3a4a commit 757de8cCopy full SHA for 757de8c
pandas/core/arrays/numeric.py
@@ -174,6 +174,8 @@ def _coerce_to_data_and_mask(
174
raise TypeError(f"{values.dtype} cannot be converted to {name}")
175
176
elif values.dtype.kind == "b" and checker(dtype):
177
+ # fastpath
178
+ mask = np.zeros(len(values), dtype=np.bool_)
179
if not copy:
180
values = np.asarray(values, dtype=default_dtype)
181
else:
@@ -190,6 +192,10 @@ def _coerce_to_data_and_mask(
190
192
if values.dtype.kind in "iu":
191
193
# fastpath
194
mask = np.zeros(len(values), dtype=np.bool_)
195
+ elif values.dtype.kind == "f":
196
+ # np.isnan is faster than is_numeric_na() for floats
197
+ # github issue: #60066
198
+ mask = np.isnan(values)
199
200
mask = libmissing.is_numeric_na(values)
201
0 commit comments