Method: Polars::Selectors.string
- Defined in:
- lib/polars/selectors.rb
.string(include_categorical: false) ⇒ Selector
Select all String (and, optionally, Categorical) string columns.
df.group_by(Polars.cs.string).agg(Polars.cs.numeric.sum).sort(Polars.cs.string) shape: (2, 3) ┌─────┬─────┬─────┐ │ w ┆ x ┆ y │ │ --- ┆ --- ┆ --- │ │ str ┆ i64 ┆ f64 │ ╞═════╪═════╪═════╡ │ xx ┆ 0 ┆ 2.0 │ │ yy ┆ 6 ┆ 7.0 │ └─────┴─────┴─────┘
1841 1842 1843 1844 1845 1846 1847 1848 |
# File 'lib/polars/selectors.rb', line 1841 def self.string(include_categorical: false) string_dtypes = [String] if include_categorical string_dtypes << Categorical end by_dtype(string_dtypes) end |