Skip to content

to_datetime with format string cannot read nanoseconds #8989

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

Closed
jorisvandenbossche opened this issue Dec 3, 2014 · 2 comments · Fixed by #8904
Closed

to_datetime with format string cannot read nanoseconds #8989

jorisvandenbossche opened this issue Dec 3, 2014 · 2 comments · Fixed by #8904
Labels
Datetime Datetime data dtype IO Data IO issues that don't fit into a more specific label
Milestone

Comments

@jorisvandenbossche
Copy link
Member

xref #8904

In the format string, %f means microseconds (https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior), but this means the nanoseconds cannot be read in using a format string:

In [11]: pd.to_datetime("2012-01-01 09:00:00.000000001", format="%Y-%m-%d %H:%M:%S.%f")
-> 
ValueError: unconverted data remains: 001
@jorisvandenbossche jorisvandenbossche added 2/3 Compat Datetime Datetime data dtype and removed 2/3 Compat labels Dec 3, 2014
@jreback jreback added the IO Data IO issues that don't fit into a more specific label label Dec 3, 2014
@jreback jreback added this to the 0.15.2 milestone Dec 3, 2014
@jreback
Copy link
Contributor

jreback commented Dec 3, 2014

ok fixed by #8904

simple really. you read in the 9 digits. last 3 are ps (*1000), first 6 are us.

@jreback
Copy link
Contributor

jreback commented Dec 5, 2014

closed by #8904

@jreback jreback closed this as completed Dec 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype IO Data IO issues that don't fit into a more specific label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants