File tree 4 files changed +10
-5
lines changed
4 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,8 @@ Dtype Conversions
133
133
s[1] = True
134
134
s
135
135
136
- - Previously as assignment to a datetimelike with a non-datetimelike would corece (:issue:`14145`).
136
+ - Previously as assignment to a datetimelike with a non-datetimelike would coerce the
137
+ non-datetime-like item being assigned (:issue:`14145`).
137
138
138
139
.. ipython:: python
139
140
@@ -206,7 +207,7 @@ Bug Fixes
206
207
Conversion
207
208
^^^^^^^^^^
208
209
209
- - Bug in assignment against datetime-like data with ``int`` may incorrectly converted to datetime-like (:issue:`14145`)
210
+ - Bug in assignment against datetime-like data with ``int`` may incorrectly converte to datetime-like (:issue:`14145`)
210
211
- Bug in assignment against ``int64`` data with ``np.ndarray`` with ``float64`` dtype may keep ``int64`` dtype (:issue:`14001`)
211
212
212
213
Original file line number Diff line number Diff line change @@ -445,6 +445,7 @@ def infer_dtype_from_array(arr, pandas_dtype=False):
445
445
-----
446
446
if pandas_dtype=False. these infer to numpy dtypes
447
447
exactly with the exception that mixed / object dtypes
448
+ are not coerced by stringifying or conversion
448
449
449
450
if pandas_dtype=True. datetime64tz-aware/categorical
450
451
types will retain there character.
@@ -465,8 +466,7 @@ def infer_dtype_from_array(arr, pandas_dtype=False):
465
466
if not is_list_like (arr ):
466
467
arr = [arr ]
467
468
468
- if pandas_dtype and (is_categorical_dtype (arr ) or
469
- is_datetime64tz_dtype (arr )):
469
+ if pandas_dtype and is_extension_type (arr ):
470
470
return arr .dtype , arr
471
471
472
472
elif isinstance (arr , ABCSeries ):
Original file line number Diff line number Diff line change 11
11
ExtensionDtype )
12
12
from .generic import (ABCCategorical , ABCPeriodIndex ,
13
13
ABCDatetimeIndex , ABCSeries ,
14
- ABCSparseArray , ABCSparseSeries , ABCCategoricalIndex
14
+ ABCSparseArray , ABCSparseSeries , ABCCategoricalIndex ,
15
15
ABCIndexClass )
16
16
from .inference import is_string_like
17
17
from .inference import * # noqa
Original file line number Diff line number Diff line change @@ -163,6 +163,10 @@ def testinfer_dtype_from_scalar(self):
163
163
dtype , val = infer_dtype_from_scalar (data )
164
164
assert dtype == np .object_
165
165
166
+ def testinfer_dtype_from_scalar_errors (self ):
167
+ with pytest .raises (ValueError ):
168
+ infer_dtype_from_scalar (np .array ([1 ]))
169
+
166
170
@pytest .mark .parametrize (
167
171
"arr, expected, pandas_dtype" ,
168
172
[('foo' , np .object_ , False ),
You can’t perform that action at this time.
0 commit comments