-
-
Notifications
You must be signed in to change notification settings - Fork 396
Add nanosecond attribute to DateTime for compatibility with pandas #246
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
Comments
I don't see why the |
It seems that pandas tries to convert the timezone aware datetime to it's own timestamp representation, but that conversion isn't triggered with the naive datetime. I don't think anyone is at fault here, as a user of both pendulum and pandas it makes it difficult to use them together. Examples:
|
OK, let's close then. |
@Dmitrii-I Sorry, I didn't necessarily mean you should close it. I was just trying to point out that even with naive It would be nice if there were interchangeable. Likely related: pandas-dev/pandas#15986 |
I can re-open it, but I got the impression from @sdispater that this is not a pendulum issue. |
Issue Example
Console Output
It appears as though pandas converts the datetime to a datetime64 behind the scenes, and validation of the datetime is throwing an exception. SolutionYou can manually reformat the date without the nanonseconds so that it passes pandas validation:
Usage
Console Output
Alternatively with a list comprehension
Console Output
This said, It would just be nice to have both tools work happily together. @jwkvam @Dmitrii-I |
|
Constructing a
DataFrame
from pendulumDateTime
fails because of missingnanosecond
attribute:However suing
naive()
it works:Would it be possible to add the
nanosecond
attribute toDateTime
class, event if it always returns 0 for now?The text was updated successfully, but these errors were encountered: