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-levelpandera
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 dtypeDateTime
"datetime64[ns]"
numpy dtypeTimedelta
"timedelta64[ns]"
numpy dtypeFloat
"float"
numpy dtypeFloat16
"float16"
numpy dtypeFloat32
"float32"
numpy dtypeFloat64
"float64"
numpy dtypeInt
"int"
numpy dtypeInt8
"int8"
numpy dtypeInt16
"int16"
numpy dtypeInt32
"int32"
numpy dtypeInt64
"int64"
numpy dtypeUInt8
"uint8"
numpy dtypeUInt16
"uint16"
numpy dtypeUInt32
"uint32"
numpy dtypeUInt64
"uint64"
numpy dtypeObject
"object"
numpy dtypeComplex
"complex"
numpy dtypeComplex64
"complex"
numpy dtypeComplex128
"complex"
numpy dtypeComplex256
"complex"
numpy dtypeCategory
pandas
"categorical"
datatypeINT8
"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 dtypeSTRING
"string"
pandas dtypes: pandas 1.0.0+.