Home Explore Blog CI



nushell

19th chunk of `book/dataframes.md`
3df8a09d1f85cbfbce495fa2427accb557b31316f416203d0000000100000def
| polars not             | dataframe             | Inverts boolean mask.                                                                            |                         |
| polars open            | any                   | Opens CSV, JSON, JSON lines, arrow, avro, or parquet file to create dataframe.                   | open                    |
| polars otherwise       | any                   | Completes a when expression.                                                                     |                         |
| polars quantile        | expression, dataframe | Aggregates the columns to the selected quantile.                                                 |                         |
| polars query           | dataframe             | Query dataframe using SQL. Note: The dataframe is always named 'df' in your query's from clause. |                         |
| polars rename          | dataframe             | Rename a dataframe column.                                                                       | rename                  |
| polars replace         | dataframe             | Replace the leftmost (sub)string by a regex pattern.                                             |                         |
| polars replace-all     | dataframe             | Replace all (sub)strings by a regex pattern.                                                     |                         |
| polars reverse         | dataframe             | Reverses the LazyFrame                                                                           |                         |
| polars rolling         | dataframe             | Rolling calculation for a series.                                                                |                         |
| polars sample          | dataframe             | Create sample dataframe.                                                                         |                         |
| polars save            | dataframe             | Saves a dataframe to disk. For lazy dataframes a sink operation will be used if the file type supports it (parquet, ipc/arrow, csv, and ndjson).|                         |
| polars schema          | dataframe             | Show schema for a dataframe.                                                                     |                         |
| polars select          | dataframe             | Selects columns from lazyframe.                                                                  | select                  |
| polars set             | dataframe             | Sets value where given mask is true.                                                             |                         |
| polars set-with-idx    | dataframe             | Sets value in the given index.                                                                   |                         |
| polars shape           | dataframe             | Shows column and row size for a dataframe.                                                       |                         |
| polars shift           | dataframe             | Shifts the values by a given period.                                                             |                         |
| polars slice           | dataframe             | Creates new dataframe from a slice of rows.                                                      |                         |
| polars sort-by         | dataframe             | Sorts a lazy dataframe based on expression(s).                                                   | sort                    |

Title: Polars Dataframe Commands (Continued)
Summary
This section continues documenting Polars dataframe commands, covering: inverting boolean masks (`not`), opening files (`open`), completing conditional expressions (`otherwise`), aggregating to quantiles (`quantile`), querying with SQL (`query`), renaming columns (`rename`), replacing substrings using regular expressions (`replace`, `replace-all`), reversing dataframes (`reverse`), performing rolling calculations (`rolling`), creating sample dataframes (`sample`), saving dataframes to disk (`save`), displaying schema information (`schema`), selecting columns (`select`), setting values based on a mask or index (`set`, `set-with-idx`), displaying dataframe shape (`shape`), shifting values (`shift`), creating slices of rows (`slice`), and sorting dataframes (`sort-by`). The table includes equivalent Nushell commands where applicable.