pandera.engines.pandas_engine.PandasDtype

class pandera.engines.pandas_engine.PandasDtype(value)[source]

Enumerate all valid pandas data types.

This class simply enumerates the valid numpy dtypes for pandas arrays. For convenience PandasDtype enums can all be accessed in the top-level pandera name space via the same enum name.

Warning

This class is deprecated and will be removed in pandera v0.9.0. Use python types, pandas type string aliases, numpy dtypes, or pandas dtypes instead. See Pandera Data Types (new) for details.

Examples

>>> import pandas as pd
>>> import pandera as pa
>>>
>>>
>>> pa.SeriesSchema(pa.PandasDtype.Int).validate(pd.Series([1, 2, 3]))
0    1
1    2
2    3
dtype: int64
>>> pa.SeriesSchema(pa.PandasDtype.Float).validate(pd.Series([1.1, 2.3, 3.4]))
0    1.1
1    2.3
2    3.4
dtype: float64
>>> pa.SeriesSchema(pa.PandasDtype.String).validate(pd.Series(["a", "b", "c"]))
0    a
1    b
2    c
dtype: object

Attributes

Bool

"bool" numpy dtype

DateTime

"datetime64[ns]" numpy dtype

Timedelta

"timedelta64[ns]" numpy dtype

Float

"float" numpy dtype

Float16

"float16" numpy dtype

Float32

"float32" numpy dtype

Float64

"float64" numpy dtype

Int

"int" numpy dtype

Int8

"int8" numpy dtype

Int16

"int16" numpy dtype

Int32

"int32" numpy dtype

Int64

"int64" numpy dtype

UInt8

"uint8" numpy dtype

UInt16

"uint16" numpy dtype

UInt32

"uint32" numpy dtype

UInt64

"uint64" numpy dtype

Object

"object" numpy dtype

Complex

"complex" numpy dtype

Complex64

"complex" numpy dtype

Complex128

"complex" numpy dtype

Complex256

"complex" numpy dtype

Category

pandas "categorical" datatype

INT8

"Int8" pandas dtype:: pandas 0.24.0+

INT16

"Int16" pandas dtype: pandas 0.24.0+

INT32

"Int32" pandas dtype: pandas 0.24.0+

INT64

"Int64" pandas dtype: pandas 0.24.0+

UINT8

"UInt8" pandas dtype: pandas 0.24.0+

UINT16

"UInt16" pandas dtype: pandas 0.24.0+

UINT32

"UInt32" pandas dtype: pandas 0.24.0+

UINT64

"UInt64" pandas dtype: pandas 0.24.0+

String

"str" numpy dtype

STRING

"string" pandas dtypes: pandas 1.0.0+.