输入/输出#

Avro#

read_avro(source, *[, columns, n_rows])

从Apache Avro格式读取到DataFrame中。

DataFrame.write_avro(文件[, 压缩, 名称])

写入Apache Avro文件。

剪贴板#

read_clipboard([separator])

从剪贴板读取文本并传递给 read_csv

DataFrame.write_clipboard(*[, separator])

DataFrame以csv格式复制到系统剪贴板,使用write_csv

CSV#

read_csv(source, *[, has_header, columns, ...])

将CSV文件读取到DataFrame中。

read_csv_batched(source, *[, has_header, ...])

批量读取CSV文件。

scan_csv(source, *[, has_header, separator, ...])

通过通配符模式从CSV文件或多个文件中懒加载读取。

DataFrame.write_csv([文件, 包含BOM, ...])

写入逗号分隔值(CSV)文件。

LazyFrame.sink_csv(路径, *[, 包含BOM, ...])

在流模式下评估查询并将结果写入CSV文件。

BatchedCsvReader.next_batches(n)

从阅读器中读取 n 批次。

数据库#

read_database(query, connection, *[, ...])

将SQL查询的结果读取到DataFrame中,给定一个连接对象。

read_database_uri(query, uri, *[, ...])

将SQL查询的结果读取到DataFrame中,给定一个URI。

DataFrame.write_database(表名, ...[, ...])

将Polars DataFrame中的数据写入数据库。

Delta Lake#

read_delta(source, *[, version, columns, ...])

从Delta湖表中读取数据到DataFrame。

scan_delta(source, *[, version, ...])

从Delta湖表中懒加载读取。

DataFrame.write_delta(目标, *[, 模式, ...])

将DataFrame写入为delta表。

Excel / ODS#

read_excel(source, *[, sheet_id, ...])

将Excel电子表格数据读取到DataFrame中。

read_ods(source, *[, sheet_id, sheet_name, ...])

将OpenOffice(ODS)电子表格数据读取到DataFrame中。

DataFrame.write_excel([workbook, worksheet, ...])

将框架数据写入Excel工作簿/工作表中的表格。

Feather / IPC#

read_ipc(source, *[, columns, n_rows, ...])

从Arrow IPC(Feather v2)文件读取到DataFrame中。

read_ipc_schema(source)

获取IPC文件的模式而不读取数据。

read_ipc_stream(source, *[, columns, ...])

从Arrow IPC记录批次流中读取到DataFrame。

scan_ipc(source, *[, n_rows, cache, ...])

通过glob模式从Arrow IPC(Feather v2)文件或多个文件中懒加载读取。

DataFrame.write_ipc(文件, *[, 压缩, ...])

写入Arrow IPC二进制流或Feather文件。

DataFrame.write_ipc_stream(file, *[, ...])

写入Arrow IPC记录批次流。

LazyFrame.sink_ipc(路径, *[, 压缩, ...])

在流模式下评估查询并将结果写入IPC文件。

Iceberg#

scan_iceberg(source, *[, snapshot_id, ...])

从Apache Iceberg表中懒加载读取。

JSON#

read_json(source, *[, schema, ...])

从JSON文件读取到DataFrame中。

read_ndjson(source, *[, schema, ...])

从以换行符分隔的JSON文件中读取到DataFrame。

scan_ndjson(source, *[, schema, ...])

通过glob模式从以换行符分隔的JSON文件或多个文件中懒加载读取。

DataFrame.write_json([file])

序列化为JSON表示。

DataFrame.write_ndjson([file])

序列化为换行符分隔的JSON表示。

LazyFrame.sink_ndjson(路径, *[, ...])

在流模式下评估查询并将结果写入NDJSON文件。

Parquet#

read_parquet(source, *[, columns, n_rows, ...])

从parquet文件中读取数据到DataFrame。

read_parquet_schema(source)

获取Parquet文件的模式而不读取数据。

scan_parquet(source, *[, n_rows, ...])

从本地或云托管的parquet文件(或文件)中懒加载读取。

DataFrame.write_parquet(file, *[, ...])

写入Apache Parquet文件。

LazyFrame.sink_parquet(路径, *[, ...])

在流模式下评估查询并将结果写入Parquet文件。

PyArrow 数据集#

连接到pyarrow数据集。

scan_pyarrow_dataset(source, *[, ...])

扫描一个pyarrow数据集。

云凭证#

云凭证配置。

CredentialProvider()

凭证提供者的基类。

CredentialProviderAWS(*[, profile_name, ...])

AWS 凭证提供者。

CredentialProviderAzure(*[, scopes, ...])

Azure 凭证提供者。

CredentialProviderGCP(*[, scopes, request, ...])

GCP 凭证提供者。