Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the default datetime fmt when using .cast(pl.Datetime) #15056

Open
mkleinbort-ic opened this issue Mar 14, 2024 · 0 comments
Open
Labels
enhancement New feature or an improvement of an existing feature

Comments

@mkleinbort-ic
Copy link

Description

Currently this code works:

df = pl.DataFrame({'datetime': ['2024-03-12 19:53:32']})

df.select(pl.col('datetime').str.to_datetime())

But this code fails

df.select(pl.col('datetime').cast(pl.Datetime))

I don't see a good argument for the .cast(pl.Datetime) not to default to just calling str.to_datetime.

That seems to be the behavior with dates.

df = pl.DataFrame({'datetime': ['2024-03-12']})

# This works
df.select(pl.col('datetime').str.to_datetime())

# This also works
df.select(pl.col('datetime').cast(pl.Date))
@mkleinbort-ic mkleinbort-ic added the enhancement New feature or an improvement of an existing feature label Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant