Skip to content

Losing Nanosecond precision upon conversion to DatetimeIndex #2252

@lterry-t

Description

@lterry-t

All,

I am experiencing a problem when converting from a TimeSeries to a DatetimeIndex. In the code below, I create a TimeSeries of nanosecond precision TimeStamps. I then convert it to a DatetimeIndex and lose the nanosecond precision (but maintain the microseconds). This appears to be a bug as the resulting elements of DatetimeIndex are of time TimeStamp and can handle nanosecond precision. Please see the snippet below.

Any help/resolution would be greatly appreciated.

Thanks,
Joe

In [233]: t1 = pandas.Timestamp((1352934390*1000000000)+1000000+1000+1)

In [234]: t2 = pandas.Timestamp((1352934390*1000000000)+1000000+1000+5)

In [235]: timeseries = pandas.TimeSeries([t1,t2])

In [236]: timeseries[0]
Out[236]: <Timestamp: 2012-11-14 23:06:30.001001001>

In [237]: datetimeindex = pandas.DatetimeIndex(timeseries)

In [238]: datetimeindex[0]
Out[238]: <Timestamp: 2012-11-14 23:06:30.001001>

In [236]: timeseries[0]
Out[236]: <Timestamp: 2012-11-14 23:06:30.001001001>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions