pandas.api.types.is_number

pandas.api.types.is_number(obj)[source]

Check if the object is a number.

Returns True when the object is a number, and False if is not.

Parameters
obj:any type

The object to check if is a number.

Returns
is_number:bool

Whether obj is a number or not.

See also

api.types.is_integer

Checks a subgroup of numbers.

Examples

>>> from pandas.api.types import is_number
>>> is_number(1)
True
>>> is_number(7.15)
True

Booleans are valid because they are int subclass.

>>> is_number(False)
True
>>> is_number("foo")
False
>>> is_number("5")
False

© 2008–2021, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.3.4/reference/api/pandas.api.types.is_number.html