Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-python/src/expr/categorical.rs
7889 views
1
use pyo3::prelude::*;
2
3
use crate::PyExpr;
4
5
#[pymethods]
6
impl PyExpr {
7
fn cat_get_categories(&self) -> Self {
8
self.inner.clone().cat().get_categories().into()
9
}
10
11
fn cat_len_bytes(&self) -> Self {
12
self.inner.clone().cat().len_bytes().into()
13
}
14
15
fn cat_len_chars(&self) -> Self {
16
self.inner.clone().cat().len_chars().into()
17
}
18
19
fn cat_starts_with(&self, prefix: String) -> Self {
20
self.inner.clone().cat().starts_with(prefix).into()
21
}
22
23
fn cat_ends_with(&self, suffix: String) -> Self {
24
self.inner.clone().cat().ends_with(suffix).into()
25
}
26
27
#[pyo3(signature = (offset, length=None))]
28
fn cat_slice(&self, offset: i64, length: Option<usize>) -> Self {
29
self.inner.clone().cat().slice(offset, length).into()
30
}
31
}
32
33