@@ -109,6 +109,54 @@ Beginning with this version, the default is now to use the more accurate parser
109
109
``floating_precision="legacy" `` to use the legacy parser. The change to using the higher precision
110
110
parser by default should have no impact on performance. (:issue: `17154 `)
111
111
112
+ .. _whatsnew_120.floating :
113
+
114
+ Experimental nullable data types for float data
115
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
116
+
117
+ We've added :class: `Float32Dtype ` / :class: `Float64Dtype ` and :class: `~arrays.FloatingArray `,
118
+ an extension data type dedicated to floating point data that can hold the
119
+ ``pd.NA `` missing value indicator (:issue: `32265 `, :issue: `34307 `).
120
+
121
+ While the default float data type already supports missing values using ``np.nan ``,
122
+ this new data type uses ``pd.NA `` (and its corresponding behaviour) as missing
123
+ value indicator, in line with the already existing nullable :ref: `integer <integer_na >`
124
+ and :ref: `boolean <boolean >` data types.
125
+
126
+ One example where the behaviour of ``np.nan `` and ``pd.NA `` is different is
127
+ comparison operations:
128
+
129
+ .. ipython :: python
130
+
131
+ # the default numpy float64 dtype
132
+ s1 = pd.Series([1.5 , None ])
133
+ s1
134
+ s1 > 1
135
+
136
+ .. ipython :: python
137
+
138
+ # the new nullable float64 dtype
139
+ s2 = pd.Series([1.5 , None ], dtype = " Float64" )
140
+ s2
141
+ s2 > 1
142
+
143
+ See the :ref: `missing_data.NA ` doc section for more details on the behaviour
144
+ when using the ``pd.NA `` missing value indicator.
145
+
146
+ As shown above, the dtype can be specified using the "Float64" or "Float32"
147
+ string (capitalized to distinguish it from the default "float64" data type).
148
+ Alternatively, you can also use the dtype object:
149
+
150
+ .. ipython :: python
151
+
152
+ pd.Series([1.5 , None ], dtype = pd.Float32Dtype())
153
+
154
+ .. warning ::
155
+
156
+ Experimental: the new floating data types are currently experimental, and its
157
+ behaviour or API may still change without warning. Expecially the behaviour
158
+ regarding NaN (distinct from NA missing values) is subject to change.
159
+
112
160
.. _whatsnew_120.enhancements.other :
113
161
114
162
Other enhancements
0 commit comments