narwhals-dev / narwhals

Lightweight and extensible compatibility layer between dataframe libraries!
https://narwhals-dev.github.io/narwhals/
MIT License
423 stars 76 forks source link

enh: `slice`, `starts_with`, `tail` methods for `str` namespace #305

Closed FBruzzesi closed 3 months ago

FBruzzesi commented 3 months ago

What type of PR is this? (check all applicable)

Related issues

None

Checklist

If you have comments or can explain your changes, please do so below.

Implements slice, starts_with and tail methods in the str namespace for Expr and Series.

It is a quite large one, but slice implementation allowed to refactor head and tail, however using slice does not allow for negative indexes as polars does. Since they were not supported anyway in the first place, I moved to this implementation but happy to discuss how to work around it.