pandera.io.pandas_io.to_script

pandera.io.pandas_io.to_script(dataframe_schema, path_or_buf=None, *, minimal=True, script_type='schema')[source]

Write a pandas-API schema or model to a Python script.

Parameters:
  • dataframe_schema – schema to write to file or dump to string.

  • path_or_buf – filepath or buf stream to write to. If None, outputs string representation of the script.

  • minimal (bool) – If True (default), omit constructor-default kwargs in the generated Column / DataFrameSchema / Field calls.

  • script_type (Literal[‘schema’, ‘model’]) – "schema" emits DataFrameSchema (default). "model" emits a DataFrameModel subclass for the pandas API.

Returns:

script string if path_or_buf is None, otherwise None.