-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Can no longer pass pd.Timestamp objects into places/expressions that take datetime64 #18447
Comments
thanks @agossard for the report, much appreciated 🙏 This regressed in #16018 (@mcrumiller fancy taking a look? maybe something similar to #18346 can solve this?) |
I'll definitely take a look. |
Yep, also for |
@MarcoGorelli, should we allow |
I suppose that should be an enhancement, I'll leave that out of this. |
Can confirm, the following used to work in 1.5: import polars as pl
import pandas as pd
t0 = pd.Timestamp("2001-01-03")
frame = pl.from_dict({
"t": ["2001-01-01", "2001-01-02", "2001-01-03", "2001-01-04"]
}).with_columns(
pl.col("t").str.to_datetime()
)
frame.filter(pl.col("t") >= t0) |
thanks @btschroer ! I think np.datetime64 I'm less sure about tbh, not sure it's worth the added complexity |
Checks
Reproducible example
This code worked in 1.5, but crashes in 1.6
This fixes it:
Understand the documentation does not explicitly say that you can pass it a pandas Timestamp, but once again, seemed a reasonable user assumption and used to work.
Also, this crashes now with similar error.
Log output
No response
Issue description
Cannot pass pd.Timestamp to functions that expect datetime.
Expected behavior
Would be nice to automatically cast the Timestamp to datetime64 on entry to polars
Installed versions
didn't get a chance to do this... it's on my work computer
The text was updated successfully, but these errors were encountered: