We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
>>> index = pandas.to_timedelta([15e-7], unit="s") >>> index[0].nanoseconds 0 >>> index[0].microseconds 2
nanoseconds range input for to_timedelta function are rounded to microseconds.
>>> index = pandas.to_timedelta([15e-7], unit="s") >>> index[0].nanoseconds 500 >>> index[0].microseconds 1
However this works fine:
>>> index = pandas.to_timedelta([1.5], unit="us") >>> index[0].nanoseconds 500 >>> index[0].microseconds 1
So it seems to be something when se choose unit="s"
pd.show_versions()
commit: None python: 3.6.3.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 158 Stepping 9, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None pandas: 0.21.1 pytest: 3.4.0 pip: 9.0.1 setuptools: 38.4.0 Cython: 0.27.3 numpy: 1.13.3 scipy: 1.0.0 pyarrow: None xarray: None IPython: 6.2.1 sphinx: 1.6.6 patsy: None dateutil: 2.6.1 pytz: 2017.2 blosc: None bottleneck: None tables: None numexpr: None feather: None matplotlib: 2.1.1 openpyxl: 1.7.0 xlrd: None xlwt: None xlsxwriter: None lxml: None bs4: None html5lib: 1.0.1 sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.10 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None
The text was updated successfully, but these errors were encountered:
@Sup3rGeo thanks for the report!
It seems this happens in this function:
In [126]: pd._libs.tslibs.timedeltas.cast_from_unit(1.5e-6, 's') Out[126]: 2000
because we round at 6 decimals:
pandas/pandas/_libs/tslibs/timedeltas.pyx
Line 234 in 405ed25
Not fully sure why we choose 6 decimals to be allowed, and not 9
Sorry, something went wrong.
Ah, this is a duplicate of #14156. Continuing discussion there further.
No branches or pull requests
Code Sample, a copy-pastable example if possible
Problem description
nanoseconds range input for to_timedelta function are rounded to microseconds.
Expected Output
However this works fine:
So it seems to be something when se choose unit="s"
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.3.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.21.1
pytest: 3.4.0
pip: 9.0.1
setuptools: 38.4.0
Cython: 0.27.3
numpy: 1.13.3
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: 1.6.6
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.1.1
openpyxl: 1.7.0
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: