pandera.api.parsers.ColumnParserΒΆ

class pandera.api.parsers.ColumnParser(*args, **kwargs)[source]ΒΆ

An object that knows how to produce a column.

ParsedColumn(parser=...) accepts a plain callable or an object implementing this protocol. The protocol exists so a parser can inspect the column it is filling (via bind) and so independent parsers that would otherwise each do their own work can be merged (via batch_key).

Methods

__init__(*args, **kwargs)[source]ΒΆ
batch_key(ctx)[source]ΒΆ

Group key for merging with sibling parsers, or None to opt out.

Parsers returning equal non-None keys are handed to batch and compiled into a single Parser covering all their targets.

Return type:

Hashable

bind(ctx)[source]ΒΆ

Return the function that produces this column.

Called once at schema-build time. Raising SchemaInitError here surfaces the problem before any data is touched.

Return type:

Callable