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

feat: `strftime` for datetime namespace #291

Closed FBruzzesi closed 3 months ago

FBruzzesi commented 3 months ago

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

Checklist

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

FBruzzesi commented 3 months ago

Regarding CI failing:

-  "2020/03/01 00:00:00"
-  "2020/04/01 00:00:00"
-  "2020/05/01 00:00:00"
+  "2020/03/01 00:…
+  "2020/04/01 00:…
+  "2020/05/01 00:…

Not sure if... should I just trim the values?!

MarcoGorelli commented 3 months ago

In Polars, there's .dt.to_string, which does the same thing. Polars also has .dt.strftime as an alias...it's one of the very few aliases in Polars.

I think here (Narwhals), because we're stricter, we should probably just pick one

For the reverse operation, we have .str.to_datetime, not .str.strptime. So, I think for this one, we should probably use .dt.to_string?

FBruzzesi commented 3 months ago

Fair enough! Let me rename those 😁

FBruzzesi commented 3 months ago

I felt left out without a "ship it" gif 😂

SadGIF

MarcoGorelli commented 3 months ago

😄 not sure why it's not showing