You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In : pd.Timedelta('1 day').isoformat()
Out: 'P1DT0H0M0S'In : pd.Timedelta(pd.Timedelta('1 day').isoformat())
Out: ValueError: invalidabbreviation: P
Problem description
A Timedelta can be formatted as an ISO 8601 Duration, but cannot be constructed from one. This makes it difficult to natively parse and convert any ISO 8601 Durations into their respective Timedelta objects.
For a specific example, write_json takes a Timedelta and writes it out in the ISO format, but read_json cannot reasonably parse that format back into a Timedelta object without such a constructor (see #19039)
Code Sample, a copy-pastable example if possible
Problem description
A
Timedelta
can be formatted as an ISO 8601 Duration, but cannot be constructed from one. This makes it difficult to natively parse and convert any ISO 8601 Durations into their respectiveTimedelta
objects.For a specific example,
write_json
takes aTimedelta
and writes it out in the ISO format, butread_json
cannot reasonably parse that format back into aTimedelta
object without such a constructor (see #19039)INSTALLED VERSIONS
commit: 4319335
python: 3.6.1.final.0
python-bits: 64
OS: Darwin
OS-release: 17.3.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.23.0.dev0+31.g4319335aa
pytest: None
pip: 9.0.1
setuptools: 27.2.0
Cython: None
numpy: 1.13.1
scipy: 0.19.1
pyarrow: None
xarray: None
IPython: 6.1.0
sphinx: 1.6.5
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.6.0
html5lib: 0.999999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: