Skip to content

BUG: Period with nanoseconds (?) #17053

Closed
@ChadFulton

Description

@ChadFulton

Code Sample, a copy-pastable example if possible

p = pd.Period('2000-01-01 00:00:00.123456789', freq='N')
print(p.freq)
print(p)
print(p + pd.Timedelta(789, 'ns'))

This results in:

<Nano>
2000-01-01 00:00:00.123456000
2000-01-01 00:00:00.123456789

Problem description

From my reading of the docs, it appears that Period objects should accept nanosecond input, and they appear to support it, above, using Timedeltas.

The problem is that it appears to truncate the input strings.

Expected Output

<Nano>
2000-01-01 00:00:00.123456789
2000-01-01 00:00:00.123457578

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Darwin
OS-release: 15.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None

pandas: 0.20.3
pytest: None
pip: 9.0.1
setuptools: 21.0.0
Cython: 0.24
numpy: 1.13.1
scipy: 0.18.0.dev0+46034f7
xarray: None
IPython: 5.0.0b4
sphinx: 1.4.4
patsy: 0.2.1
dateutil: 2.2
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: 2.4
feather: None
matplotlib: 2.0.0rc2
openpyxl: 1.8.6
xlrd: 0.9.2
xlwt: None
xlsxwriter: None
lxml: 3.4.0
bs4: 4.3.2
html5lib: None
sqlalchemy: 1.0.14
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
jinja2: 2.8
s3fs: None
pandas_gbq: None
pandas_datareader: 0.2.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions