Skip to content

Commit fea1be7

Browse files
committed
added whatsnew entry
1 parent b547d50 commit fea1be7

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

doc/source/whatsnew/v0.24.0.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,40 @@ For situations where you need an ``ndarray`` of ``Interval`` objects, use
238238
np.asarray(idx)
239239
idx.values.astype(object)
240240

241+
242+
.. _whatsnew_0240.api.types.is_scalar:
243+
244+
Support for PEP 3141 numbers
245+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
246+
247+
The `is_scalar` function now returns True when a `Number` or `Fraction` is passed.
248+
249+
Previous Behavior:
250+
251+
.. code-block:: ipython
252+
253+
In [1]: pandas.api.types.is_scalar(fractions.Fraction(1))
254+
Out[1]:
255+
False
256+
257+
In [2]: pandas.api.types.is_scalar(numbers.Number(1))
258+
Out[2]:
259+
False
260+
261+
New Behavior:
262+
263+
.. code-block:: ipython
264+
265+
In [1]: pandas.api.types.is_scalar(fractions.Fraction(1))
266+
Out[1]:
267+
True
268+
269+
In [2]: pandas.api.types.is_scalar(numbers.Number(1))
270+
Out[2]:
271+
True
272+
273+
This mirrors ``numpy.isscalar``, which already supports PEP 3141 and is a requirement for `pandas`.
274+
241275
.. _whatsnew_0240.api.timezone_offset_parsing:
242276

243277
Parsing Datetime Strings with Timezone Offsets

0 commit comments

Comments
 (0)