Skip to content

Commit f43f021

Browse files
add basic whatsnew note
1 parent 6a1d822 commit f43f021

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

doc/source/whatsnew/v1.1.0.rst

+59
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,65 @@ If needed you can adjust the bins with the argument ``offset`` (a Timedelta) tha
194194

195195
For a full example, see: :ref:`timeseries.adjust-the-start-of-the-bins`.
196196

197+
.. _whatsnew_110.floating:
198+
199+
Experimental nullable data types for float data
200+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
201+
202+
We've added :class:`Float32Dtype` / :class:`Float64Dtype` and :class:`~arrays.FloatingArray`,
203+
an extension data type dedicated to floating point data that can hold the
204+
``pd.NA`` missing value indicator (:issue:`32265`, :issue:`34307`).
205+
206+
While the default float data type already supports missing values using ``np.nan``,
207+
this new data type uses ``pd.NA`` (and its corresponding behaviour) as missing
208+
value indicator, in line with the already existing nullable :ref:`integer <integer_na>`
209+
and :ref:`boolean <boolean>` data types.
210+
211+
One example where the behaviour of ``np.nan`` and ``pd.NA`` is diffferent is
212+
comparison operations:
213+
214+
.. code-block:: python
215+
216+
# the default numpy float64 dtype
217+
>>> s1 = pd.Series([1.5, None])
218+
>>> s1
219+
0 1.5
220+
1 NaN
221+
dtype: float64
222+
223+
>>> s1 > 1
224+
0 True
225+
1 False
226+
dtype: bool
227+
228+
# the new nullable float64 dtype
229+
>>> s2 = pd.Series([1.5, None], dtype="Float64")
230+
>>> s2
231+
0 1.5
232+
1 <NA>
233+
dtype: Float64
234+
235+
>>> s2 > 1
236+
0 True
237+
1 <NA>
238+
dtype: boolean
239+
240+
See the :ref:`missing_data.NA` doc section for more details on the behaviour
241+
when using the ``pd.NA`` missing value indicator.
242+
243+
As shown above, the dtype can be specified using the "Float64" or "Float32"
244+
string (capitalized to distinguish it from the default "float64" data type).
245+
Alternatively, you can also use the dtype object:
246+
247+
.. ipython:: python
248+
249+
pd.Series([1.5, None], dtype=pd.Float32Dtype())
250+
251+
.. warning::
252+
253+
Experimental: the new floating data types are currently experimental, and its
254+
behaviour or API may still change without warning. Expecially the behaviour
255+
regarding NaN (distinct from NA missing values) is subject to change.
197256

198257
.. _whatsnew_110.enhancements.other:
199258

0 commit comments

Comments
 (0)