File tree 1 file changed +49
-4
lines changed
1 file changed +49
-4
lines changed Original file line number Diff line number Diff line change @@ -59,13 +59,58 @@ Backwards incompatible API changes
59
59
Dtype Conversions
60
60
^^^^^^^^^^^^^^^^^
61
61
62
- Example about setitem / where with bools.
62
+ - Previously assignments, ``.where()`` and ``.fillna()`` with a ``bool`` assignment, would coerce to
63
+ same type (e.g. int / float), or raise for datetimelikes. These will now preseve the bools with ``object`` dtypes. (:issue:`16821`).
63
64
65
+ .. ipython:: python
64
66
67
+ s = Series([1, 2, 3])
65
68
66
- - Inconsistent behavior in ``.where()`` with datetimelikes which would raise rather than coerce to ``object`` (:issue:`16402`)
67
- - Bug in assignment against datetime-like data with ``int`` may incorrectly convert to datetime-like (:issue:`14145`)
68
- - Bug in assignment against ``int64`` data with ``np.ndarray`` with ``float64`` dtype may keep ``int64`` dtype (:issue:`14001`)
69
+ .. code-block:: python
70
+
71
+ In [5]: s[1] = True
72
+
73
+ In [6]: s
74
+ Out[6]:
75
+ 0 1
76
+ 1 1
77
+ 2 3
78
+ dtype: int64
79
+
80
+ New Behavior
81
+
82
+ .. ipython:: python
83
+
84
+ s[1] = True
85
+ s
86
+
87
+ - Previously as assignment to a datetimelike with a non-datetimelike would corece (:issue:`14145`).
88
+
89
+ .. ipython:: python
90
+
91
+ s = pd.Series([pd.Timestamp('2011-01-01'), pd.Timestamp('2012-01-01')])
92
+
93
+ .. code-block:: python
94
+
95
+ In [1]: s[1] = 1
96
+
97
+ In [2]: s
98
+ Out[2]:
99
+ 0 2011-01-01 00:00:00.000000000
100
+ 1 1970-01-01 00:00:00.000000001
101
+ dtype: datetime64[ns]
102
+
103
+ These now coerce to ``object`` dtype.
104
+
105
+ .. ipython:: python
106
+
107
+ s[1] = 1
108
+ s
109
+
110
+ - Additional bug fixes w.r.t. dtype conversions.
111
+
112
+ - Inconsistent behavior in ``.where()`` with datetimelikes which would raise rather than coerce to ``object`` (:issue:`16402`)
113
+ - Bug in assignment against ``int64`` data with ``np.ndarray`` with ``float64`` dtype may keep ``int64`` dtype (:issue:`14001`)
69
114
70
115
.. _whatsnew_0210.api:
71
116
You can’t perform that action at this time.
0 commit comments