Expand description
IO layer for frankenpandas: round-trips between DataFrame and the
fifteen supported on-disk / wire formats — CSV, JSON, JSONL, Parquet, ORC,
HDF5, Excel (XLSX), Feather (Arrow IPC v2), SQL, Markdown, LaTeX, HTML,
XML, Pickle, and Stata.
§Format readers / writers
- CSV:
read_csv,read_csv_with_options,write_csv,write_csv_string - JSON / JSONL:
read_json,read_jsonl,write_json,write_jsonl - Parquet:
read_parquet,write_parquet - ORC:
read_orc,write_orc - HDF5:
read_hdf,write_hdffor the keyed DataFrame snapshot surface. - Excel:
read_excel,write_excel - Feather / Arrow IPC:
read_feather,write_feather,read_ipc_stream_bytes,write_ipc_stream_bytes - SQL:
read_sql,read_sql_table,write_sql,write_sql_with_options, plus the chunked variants (read_sql_chunks,SqlChunkIterator). - Markdown / LaTeX / HTML / XML:
write_markdown_string,write_latex_string,write_html_string,read_html_str,write_xml_string,read_xml_str. - Pickle:
write_pickle_bytes,read_pickle_bytesfor the fail-closed FrankenPandas DataFrame snapshot envelope. - Stata:
write_stata_bytes,read_stata_bytesfor the bounded DTA V118 DataFrame round-trip surface.
Each format has a per-call options struct (CsvReadOptions,
ExcelReadOptions, SqlReadOptions, SqlWriteOptions, …) so
pandas-shaped keyword arguments thread cleanly through the Rust API.
The DataFrameIoExt extension trait adds df.to_csv(path) /
df.to_parquet(path) / etc. methods on DataFrame for ergonomic
method-chain use.
§SQL backend abstraction
SQL IO is built around the SqlConnection trait — a backend-neutral
contract that mirrors the supported subset of pandas /
SQLAlchemy.Inspector. Concrete backends (today: rusqlite via the
sql-sqlite feature) implement the trait and inherit:
- Mutation primitives:
SqlConnection::query,SqlConnection::execute_batch,SqlConnection::insert_rows,SqlConnection::truncate_table,SqlConnection::with_transaction. - Capability probes:
SqlConnection::dialect_name,SqlConnection::server_version,SqlConnection::max_param_count,SqlConnection::max_identifier_length,SqlConnection::supports_returning,SqlConnection::supports_schemas. - Identifier / parameter shape hooks:
SqlConnection::quote_identifier,SqlConnection::parameter_marker. - Introspection (matching
SQLAlchemy.Inspectorshape):SqlConnection::list_tables,SqlConnection::list_views,SqlConnection::list_schemas,SqlConnection::table_schema,SqlConnection::list_indexes,SqlConnection::list_foreign_keys,SqlConnection::list_unique_constraints,SqlConnection::primary_key_columns,SqlConnection::table_comment.
The SqlInspector facade wraps a &C: SqlConnection and exposes the
whole introspection API as methods on a single bundle:
let inspector = SqlInspector::new(&conn);
let bundle = inspector
.reflect_table("users", None)?
.expect("table exists");
for col in &bundle.columns {
println!("{}: {:?}", col.name, col.declared_type);
}SqlReflectedTable is the bundled metadata returned by
SqlInspector::reflect_table / SqlInspector::reflect_all_tables /
SqlInspector::reflect_all_views — columns, primary key, indexes,
foreign keys, unique constraints, and table-level comment, with
per-column lookup helpers.
§Cargo features
sql-sqlite(default): bindSqlConnectionforrusqlite::Connection.sql-postgresql,sql-mysql: placeholder feature flags for the fd90 Phase 2 backend integrations (no concrete bindings yet).
Use default-features = false to drop the rusqlite dep when only the
non-SQL formats are needed.
Structs§
- CsvRead
Options - CsvWrite
Options - Options controlling CSV serialization.
- Excel
Read Options - Options for reading Excel files.
- Excel
Write Options - Options for serializing a DataFrame to Excel.
- FwfRead
Options - Options for
read_fwf_strandread_fwf. - HdfRead
Options - Options controlling HDF5 path reads.
- HdfWrite
Options - Options controlling HDF5 path writes.
- Html
Read Options - Options controlling HTML table parsing.
- Html
Write Options - Options controlling HTML table serialization.
- Latex
Write Options - Options controlling LaTeX table serialization.
- Markdown
Write Options - Options controlling Markdown table serialization.
- Mysql
Connection - Wrapper around
mysql::Connproviding interior mutability for theSqlConnectiontrait (which requires&self). - Pickle
Read Options - Options controlling Pickle deserialization.
- Pickle
Write Options - Options controlling Pickle serialization.
- Postgres
Connection - Wrapper around
postgres::Clientproviding interior mutability for theSqlConnectiontrait (which requires&self). - SqlBackend
Caps - Backend capability summary exposed through
SqlInspector. - SqlChunk
Iterator - Iterator over DataFrame chunks produced by a SQL query.
- SqlColumn
Schema - Backend-neutral SQL column metadata.
- SqlForeign
KeySchema - Backend-neutral SQL foreign-key constraint metadata.
- SqlIndex
Schema - Backend-neutral SQL index metadata.
- SqlIndexed
Chunk Iterator - Iterator over SQL DataFrame chunks with optional per-chunk index promotion.
- SqlInspector
- Backend-agnostic introspection facade matching the
SQLAlchemy.Inspectorshape. - SqlQuery
Result - Backend-agnostic in-memory representation of a SQL query result.
- SqlRead
Options - Options for reading SQL query results into a DataFrame.
- SqlReflected
Table - Bundle of all introspection metadata for a single SQL table.
- SqlTable
Schema - Backend-neutral SQL table metadata.
- SqlUnique
Constraint Schema - Backend-neutral SQL unique-constraint metadata.
- SqlWrite
Options - Options for writing a DataFrame to SQL.
- Stata
Write Options - Options controlling Stata DTA serialization.
- XmlRead
Options - Options controlling XML parsing.
- XmlWrite
Options - Options controlling XML serialization.
Enums§
- CsvOn
BadLines - IoError
- Json
Orient - Pickle
Protocol - Pickle protocol used by
write_pickle_bytes_with_options. - SqlIf
Exists - Options for writing a DataFrame to SQL.
- SqlInsert
Method - Strategy for emitting INSERT statements during
write_sql.
Constants§
- DEFAULT_
HDF5_ KEY - Default HDF5 group key used by
read_hdfandwrite_hdf.
Traits§
- Data
Frame IoExt - Extension trait that adds IO convenience methods to
DataFrame. - Series
IoExt - Extension trait that adds IO convenience methods to
Series. - SqlConnection
- Minimal SQL connection surface needed by FrankenPandas SQL IO.
Functions§
- inspect
- Convenience constructor for
SqlInspector. - list_
sql_ foreign_ keys - List foreign-key constraints declared on a SQL table, optionally schema-scoped.
- list_
sql_ indexes - List user-defined indexes on a SQL table, optionally schema-scoped.
- list_
sql_ schemas - List user-visible schemas exposed by the SQL backend.
- list_
sql_ tables - List user-visible table names known to the SQL backend.
- list_
sql_ unique_ constraints - List UNIQUE constraints declared on a SQL table.
- list_
sql_ views - List user-visible view names known to the SQL backend.
- read_
clipboard - Reject-closed clipboard reader, matching
pd.read_clipboard()shape. - read_
csv - read_
csv_ str - read_
csv_ with_ index_ cols - Read CSV and promote the named columns into a row index / row MultiIndex.
- read_
csv_ with_ index_ cols_ path - read_
csv_ with_ options - read_
csv_ with_ options_ path - read_
excel - Read an Excel (.xlsx/.xls/.xlsb/.ods) file into a DataFrame.
- read_
excel_ bytes - Read Excel from in-memory bytes.
- read_
excel_ bytes_ with_ index_ cols - read_
excel_ sheets - read_
excel_ sheets_ bytes - Read multiple sheets from Excel bytes.
- read_
excel_ sheets_ ordered - Read multiple sheets from an Excel file.
- read_
excel_ sheets_ ordered_ bytes - Byte-based counterpart to
read_excel_sheets_ordered. - read_
excel_ with_ index_ cols - read_
feather - Read a DataFrame from an Arrow IPC (Feather v2) file.
- read_
feather_ bytes - Read a DataFrame from Arrow IPC (Feather v2) bytes in memory.
- read_
fwf - Read a fixed-width file from disk, matching
pd.read_fwf(path, ...). - read_
fwf_ str - Parse a fixed-width string, matching
pd.read_fwf(io.StringIO(s), ...). - read_
gbq - Reject-closed BigQuery reader, matching
pd.read_gbq(query, project_id). - read_
hdf - Read a DataFrame from the default HDF5 key.
- read_
hdf_ key - Read a DataFrame from an explicit HDF5 key.
- read_
hdf_ with_ options - Read a DataFrame from an HDF5 file with options.
- read_
html - read_
html_ str - Parse a DataFrame from the first HTML table in a document string.
- read_
html_ str_ with_ options - Parse a DataFrame from an HTML document string with options.
- read_
html_ with_ options - read_
ipc_ stream_ bytes - Read a DataFrame from Arrow IPC stream bytes (streaming format).
- read_
json - read_
json_ str - read_
jsonl - Read a DataFrame from a JSONL file.
- read_
jsonl_ str - read_
orc - Read a DataFrame from an ORC file.
- read_
orc_ bytes - Read a DataFrame from in-memory ORC bytes.
- read_
parquet - Read a DataFrame from a Parquet file.
- read_
parquet_ bytes - Read a DataFrame from in-memory Parquet bytes.
- read_
pickle - Read a DataFrame from a Pickle file.
- read_
pickle_ bytes - Deserialize a DataFrame from Pickle bytes.
- read_
pickle_ bytes_ with_ options - Deserialize a DataFrame from Pickle bytes with options.
- read_
pickle_ with_ options - Read a DataFrame from a Pickle file with options.
- read_
sas - Reject-closed SAS reader, matching
pd.read_sas(path). - read_
spss - Reject-closed SPSS reader, matching
pd.read_spss(path). - read_
sql - Read the result of a SQL query into a DataFrame.
- read_
sql_ chunks - Read a SQL query result as an iterator of DataFrame chunks.
- read_
sql_ chunks_ with_ index_ col - Read a SQL query result as DataFrame chunks with optional index promotion.
- read_
sql_ chunks_ with_ options - Read a SQL query result as DataFrame chunks with read-time options.
- read_
sql_ chunks_ with_ options_ and_ index_ col - Read a SQL query result as DataFrame chunks with read-time options and optional index promotion.
- read_
sql_ query - Read the result of a SQL query into a DataFrame.
- read_
sql_ query_ chunks - Read the result of a SQL query as an iterator of DataFrame chunks.
- read_
sql_ query_ chunks_ with_ index_ col - Read a SQL query result as chunks with one column promoted to each chunk’s index.
- read_
sql_ query_ chunks_ with_ options - Read the result of a SQL query as chunks with read-time options.
- read_
sql_ query_ chunks_ with_ options_ and_ index_ col - Read a SQL query result as chunks with read-time options and index promotion.
- read_
sql_ query_ with_ index_ col - Read a SQL query result with one column promoted to the index.
- read_
sql_ query_ with_ options - Read the result of a SQL query into a DataFrame with read-time options.
- read_
sql_ query_ with_ options_ and_ index_ col - Read a SQL query result with read-time options and optional index promotion.
- read_
sql_ table - Read an entire SQL table into a DataFrame.
- read_
sql_ table_ chunks - Read an entire SQL table as an iterator of DataFrame chunks.
- read_
sql_ table_ chunks_ with_ index_ col - Read an entire SQL table as chunks with one column promoted to each chunk’s index.
- read_
sql_ table_ chunks_ with_ options - Read an entire SQL table as DataFrame chunks with read-time options.
- read_
sql_ table_ chunks_ with_ options_ and_ index_ col - Read an entire SQL table as chunks with read-time options and optional index promotion.
- read_
sql_ table_ columns - Read a subset of columns from a SQL table.
- read_
sql_ table_ columns_ chunks - Read a subset of columns from a SQL table as DataFrame chunks.
- read_
sql_ table_ columns_ chunks_ with_ index_ col - Read a subset of columns from a SQL table as chunks with optional index promotion.
- read_
sql_ table_ columns_ with_ index_ col - Read a subset of columns from a SQL table with optional index promotion.
- read_
sql_ table_ with_ index_ col - Read an entire SQL table with one column promoted to the index.
- read_
sql_ table_ with_ options - Read an entire SQL table into a DataFrame with read-time options.
- read_
sql_ table_ with_ options_ and_ index_ col - Read an entire SQL table with read-time options and optional index promotion.
- read_
sql_ with_ index_ col - Read a SQL query result with one column promoted to the index.
- read_
sql_ with_ options - Read the result of a SQL query into a DataFrame with read-time options.
- read_
stata - Read a DataFrame from a Stata DTA file.
- read_
stata_ bytes - Read a DataFrame from Stata DTA bytes.
- read_
table - Read a tab-separated file from disk, matching
pd.read_table(path). - read_
table_ str - Parse a tab-separated string, matching
pd.read_table(io.StringIO(s)). - read_
table_ with_ options - Parse a tab-separated string with explicit options. The caller-supplied
options.delimiteris preserved when it differs from the comma default to allow override; otherwise it is forced tob'\t'so that the pandasread_tablesemantics surviveCsvReadOptions::default(). - read_
table_ with_ options_ path - Read a tab-separated file from disk with explicit options. The
caller-supplied delimiter is honored when it has been overridden from
the comma default; otherwise it is forced to
b'\t'. - read_
xml - read_
xml_ str - Parse a DataFrame from a row-oriented XML document string.
- read_
xml_ str_ with_ options - Parse a DataFrame from a row-oriented XML document string with options.
- read_
xml_ with_ options - series_
from_ arrow_ array - Rebuild a Series from an Arrow array and explicit dtype metadata.
- series_
to_ arrow_ array - Convert a Series to its Arrow data type plus backing array.
- sql_
backend_ caps - Gather the backend capability probes into one typed bundle.
- sql_
max_ identifier_ length - Maximum identifier length supported by the SQL backend, or
Nonewhen no documented limit exists. - sql_
max_ insert_ rows - Maximum INSERT rows for
column_count, derived from the backend’s bound-parameter ceiling. - sql_
max_ param_ count - Maximum bound parameters supported by the SQL backend, if known.
- sql_
primary_ key_ columns - Return the primary-key column names for a SQL table, ordered by the table’s primary-key ordinal.
- sql_
server_ version - Probe the SQL backend’s server version string.
- sql_
supports_ returning - Whether the SQL backend supports native
INSERT ... RETURNING. - sql_
supports_ schemas - Whether the SQL backend exposes schema-qualified namespaces.
- sql_
table_ comment - Probe the table-level comment for a SQL table, optionally schema-scoped.
- sql_
table_ schema - Introspect a SQL table’s column metadata, optionally schema-scoped.
- truncate_
sql_ table - Reset a SQL table to empty without dropping its definition.
- write_
csv - write_
csv_ string - write_
csv_ string_ with_ options - Serialize a DataFrame to CSV with explicit options.
- write_
excel - Write a DataFrame to an Excel (.xlsx) file.
- write_
excel_ bytes - Write a DataFrame to Excel (.xlsx) bytes in memory.
- write_
excel_ bytes_ with_ options - Serialize a DataFrame to Excel bytes with explicit options.
- write_
excel_ with_ options - File-based counterpart to
write_excel_bytes_with_options. - write_
feather - Write a DataFrame to an Arrow IPC (Feather v2) file.
- write_
feather_ bytes - Write a DataFrame to Arrow IPC (Feather v2) bytes in memory.
- write_
hdf - Write a DataFrame to the default HDF5 key.
- write_
hdf_ key - Write a DataFrame to an explicit HDF5 key.
- write_
hdf_ series - Write a Series to the default HDF5 key.
- write_
hdf_ series_ key - Write a Series to an explicit HDF5 key.
- write_
hdf_ with_ options - Write a DataFrame to an HDF5 file with options.
- write_
html - write_
html_ string - write_
html_ string_ with_ options - Serialize a DataFrame to an HTML table string.
- write_
html_ with_ options - write_
ipc_ stream_ bytes - Write a DataFrame to Arrow IPC stream bytes (streaming format, no random access).
- write_
json - write_
json_ string - write_
jsonl - Write a DataFrame to a JSONL file.
- write_
jsonl_ string - Write a DataFrame to JSONL (JSON Lines) format.
- write_
latex - Write a DataFrame to a LaTeX tabular file.
- write_
latex_ string - write_
latex_ string_ with_ options - Serialize a DataFrame to a booktabs-compatible LaTeX tabular block.
- write_
latex_ with_ options - Write a DataFrame to a LaTeX tabular file with explicit options.
- write_
markdown - Write a DataFrame to a Markdown table file.
- write_
markdown_ string - write_
markdown_ string_ with_ options - Serialize a DataFrame to a GitHub-style Markdown table.
- write_
markdown_ with_ options - Write a DataFrame to a Markdown table file with explicit options.
- write_
orc - Write a DataFrame to an ORC file.
- write_
orc_ bytes - Write a DataFrame to an in-memory ORC buffer.
- write_
parquet - Write a DataFrame to a Parquet file.
- write_
parquet_ bytes - Write a DataFrame to an in-memory Parquet buffer.
- write_
pickle - Write a DataFrame to a Pickle file.
- write_
pickle_ bytes - write_
pickle_ bytes_ with_ options - Serialize a DataFrame to Pickle bytes.
- write_
pickle_ with_ options - Write a DataFrame to a Pickle file with options.
- write_
sql - Write a DataFrame to a SQL table.
- write_
sql_ with_ options - Write a DataFrame to a SQLite table with pandas-style index options.
- write_
stata - Write a DataFrame to a Stata DTA file.
- write_
stata_ bytes - write_
stata_ bytes_ with_ options - Serialize a DataFrame to Stata DTA bytes.
- write_
stata_ with_ options - Write a DataFrame to a Stata DTA file with explicit options.
- write_
xml - write_
xml_ string - write_
xml_ string_ with_ options - Serialize a DataFrame to an XML document string.
- write_
xml_ with_ options