pandera.typing.DataFrame

class pandera.typing.DataFrame(data=None, index=None, columns=None, dtype=None, copy=None)[source]

A generic type for pandas.DataFrame.

new in 0.5.0

Attributes

T

The transpose of the DataFrame.

at

Access a single value for a row/column label pair.

attrs

Dictionary of global attributes of this dataset.

axes

Return a list representing the axes of the DataFrame.

columns

The column labels of the DataFrame.

default_dtype

dtypes

Return the dtypes in the DataFrame.

empty

Indicator whether Series/DataFrame is empty.

flags

Get the properties associated with this pandas object.

iat

Access a single value for a row/column pair by integer position.

iloc

Purely integer-location based indexing for selection by position.

index

The index (row labels) of the DataFrame.

loc

Access a group of rows and columns by label(s) or a boolean array.

ndim

Return an int representing the number of axes / array dimensions.

shape

Return a tuple representing the dimensionality of the DataFrame.

size

Return an int representing the number of elements in this object.

style

Returns a Styler object.

values

Return a Numpy representation of the DataFrame.

Methods

classmethod from_format(obj, config)[source]

Converts serialized data from a specific format specified in the pandera.api.pandas.model.DataFrameModel config options from_format and from_format_kwargs.

Parameters:
  • obj (Any) – object representing a serialized dataframe.

  • config – dataframe model configuration object.

Return type:

DataFrame

static from_records(schema, data, **kwargs)[source]

Convert structured or record ndarray to pandera-validated DataFrame.

Creates a DataFrame object from a structured ndarray, sequence of tuples or dicts, or DataFrame.

See pandas.DataFrame.from_records for more details.

Return type:

DataFrame[~DataFrameModel]

classmethod pydantic_validate(obj, schema_model)[source]

Verify that the input can be converted into a pandas dataframe that meets all schema requirements.

This is for pydantic >= v2

Return type:

DataFrame

classmethod to_format(data, config)[source]

Converts a dataframe to the format specified in the pandera.api.pandas.model.DataFrameModel config options to_format and to_format_kwargs.

Parameters:
  • data (DataFrame) – convert this data to the specified format

  • config – :py:cl

Return type:

Any