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
(sorry for not thinking of a better title...)
import pandas as pd print(pd.Timedelta(seconds=-0.5)
This outputs -1 days +23:59:59.500000
-1 days +23:59:59.500000
-00:00:00:5000000 or similar
-00:00:00:5000000
pd.show_versions()
commit: None python: 3.6.0.final.0 python-bits: 64 OS: Linux OS-release: 4.8.0-39-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8
pandas: 0.19.2 nose: 1.3.7 pip: 9.0.1 setuptools: 27.2.0 Cython: 0.25.2 numpy: 1.12.0 scipy: 0.18.1 statsmodels: None xarray: None IPython: 5.3.0 sphinx: 1.5.3 patsy: None dateutil: 2.6.0 pytz: 2016.10 blosc: None bottleneck: None tables: 3.3.0 numexpr: 2.6.2 matplotlib: 2.0.0.post3537+g0151c05 openpyxl: None xlrd: None xlwt: None xlsxwriter: None lxml: None bs4: None html5lib: 0.999 httplib2: 0.10.3 apiclient: None sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.9.5 boto: None pandas_datareader: None
The text was updated successfully, but these errors were encountered:
Just realised that this is because of the weird formatting of timedeltas, sorry.
Sorry, something went wrong.
yeah this is unfortunate but how python does this. I agree its cumbersome (and of course was harder to implement this way).
In [1]: pd.Timedelta('-0.5s') Out[1]: Timedelta('-1 days +23:59:59.500000')
we however accept negatives in parsing so all is not lost.
what are your thoughts on actually changing the repr though? we could certainly do it.
In [3]: datetime.timedelta(seconds=-0.5) Out[3]: datetime.timedelta(-1, 86399, 500000) In [4]: datetime.timedelta(seconds=0.5) Out[4]: datetime.timedelta(0, 0, 500000)
Changing repr would be a great idea! see #17232
No branches or pull requests
(sorry for not thinking of a better title...)
Code Sample, a copy-pastable example if possible
Problem description
This outputs
-1 days +23:59:59.500000
Expected Output
-00:00:00:5000000
or similarOutput of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.0.final.0
python-bits: 64
OS: Linux
OS-release: 4.8.0-39-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8
pandas: 0.19.2
nose: 1.3.7
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.25.2
numpy: 1.12.0
scipy: 0.18.1
statsmodels: None
xarray: None
IPython: 5.3.0
sphinx: 1.5.3
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: 3.3.0
numexpr: 2.6.2
matplotlib: 2.0.0.post3537+g0151c05
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: 0.10.3
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.5
boto: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: