polars query
for dataframe
Query dataframe using SQL. Note: The dataframe is always named 'df' in your query's from clause.
This command requires a plugin
The polars query
command resides in the polars
plugin. To use this command, you must install and register nu_plugin_polars
. See the Plugins chapter in the book for more information.
Signature
> polars query {flags} (sql)
Parameters
sql
: sql query
Input/output types:
input | output |
---|---|
any | any |
Examples
Query dataframe using SQL
> [[a b]; [1 2] [3 4]] | polars into-df | polars query 'select a from df'
╭───┬───╮
│ # │ a │
├───┼───┤
│ 0 │ 1 │
│ 1 │ 3 │
╰───┴───╯