← 返回命令列表

Linux command

polars 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Read and display CSV file

polars read [file.csv]

Query with SQL

polars sql "SELECT * FROM '[file.csv]' WHERE value > 100"

Convert CSV to Parquet

polars convert [input.csv] [output.parquet]

Show schema of file

polars schema [file.parquet]

Filter and output as JSON

polars sql "SELECT name, score FROM '[data.csv]' ORDER BY score DESC LIMIT 10" -o json

Join two files

polars sql "SELECT * FROM '[a.csv]' JOIN '[b.csv]' ON a.id = b.id"

说明

polars is the command-line interface for Polars, a fast DataFrame library. It provides SQL querying and format conversion for data files without writing code. The sql command executes SQL queries directly on files. Reference files as table names in quotes within the query. Polars' query engine optimizes execution for large datasets. Supported formats include CSV, Parquet, JSON, and Arrow. The convert command transforms between formats, useful for creating optimized Parquet files from CSV sources. Polars uses Apache Arrow columnar format internally, enabling efficient processing of large datasets with minimal memory overhead. Query optimization includes predicate pushdown and projection.

参数

-o, --output _format_
Output format: csv, json, parquet, table.
--delimiter _char_
CSV delimiter character.
--no-header
CSV has no header row.
-n, --limit _rows_
Limit output rows.
-h, --help
Display help information.
-V, --version
Display version information.

FAQ

What is the polars command used for?

polars is the command-line interface for Polars, a fast DataFrame library. It provides SQL querying and format conversion for data files without writing code. The sql command executes SQL queries directly on files. Reference files as table names in quotes within the query. Polars' query engine optimizes execution for large datasets. Supported formats include CSV, Parquet, JSON, and Arrow. The convert command transforms between formats, useful for creating optimized Parquet files from CSV sources. Polars uses Apache Arrow columnar format internally, enabling efficient processing of large datasets with minimal memory overhead. Query optimization includes predicate pushdown and projection.

How do I run a basic polars example?

Run `polars read [file.csv]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -o, --output _format_ do in polars?

Output format: csv, json, parquet, table.