pandas: pd.Timestamp.isoformat does not implement keyword timespec
Code Sample
[IN]
import pandas as pd
now = pd.Timestamp.utcnow()
help(now.isoformat)
[OUT] Help on method isoformat in module pandas._libs.tslibs.timestamps:
isoformat(sep='T') method of pandas._libs.tslibs.timestamps.Timestamp instance
[sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].
sep is used to separate the year from the time, and defaults to 'T'.
timespec specifies what components of the time to include (allowed values are 'auto', 'hours', 'minutes', 'seconds', 'milliseconds', and 'microseconds').
[IN]
now.isoformat(timespec="seconds")
[OUT] ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-8-3626478eeb62> in <module>
----> 1 now.isoformat(timespec="seconds")
pandas\_libs\tslibs\timestamps.pyx in pandas._libs.tslibs.timestamps.Timestamp.isoformat()
TypeError: isoformat() got an unexpected keyword argument 'timespec'
[IN]
now.to_pydatetime().isoformat(timespec="seconds")
[OUT] ‘2019-04-18T07:38:50+00:00’
Problem description
The help method has given me the feeling that I can use timespec just like I can with standard datetime objects (since python 3.6).
Expected Output
We could mimic standard datetime.isoformat behavior, or at least remove this false information from the help message.
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None python: 3.7.3.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 142 Stepping 9, GenuineIntel byteorder: little LC_ALL: None LANG: fr_FR.UTF-8 LOCALE: None.None
pandas: 0.24.2 pytest: 4.4.1 pip: 19.0.3 setuptools: 41.0.0 Cython: None numpy: 1.16.2 scipy: 1.2.1 pyarrow: None xarray: None IPython: 7.4.0 sphinx: 2.0.1 patsy: 0.5.1 dateutil: 2.8.0 pytz: 2019.1 blosc: None bottleneck: None tables: None numexpr: None feather: None matplotlib: 3.0.3 openpyxl: None xlrd: None xlwt: None xlsxwriter: None lxml.etree: 4.3.3 bs4: 4.7.1 html5lib: None sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.10.1 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None gcsfs: None
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 10
- Comments: 15 (8 by maintainers)
@boringow this is an open issue you are welcome to submit a PR there is an open PR but it is stale