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
Passing a Python list containing a NA value works, as does passing an Int64 Series that does not contain NA values. The functionality between these cases should be equivalent.
Expected Output
pd.to_timedelta() output returns a timedelta64 Series containing NA values when the input is an Int64 Series containg NA values:
0<NA>dtype: timedelta64[ns]
Output of pd.show_versions()
INSTALLED VERSIONS
commit : 3b6915e
python : 3.7.7.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-7634-generic
Version : #38159534531720.04~a8480ad-Ubuntu SMP Wed Jul 22 15:13:45 UTC
machine : x86_64
processor :
byteorder : little
LC_ALL : C.UTF-8
LANG : C.UTF-8
LOCALE : en_US.UTF-8
Thanks for the report. sequence_to_td64ns should probably handle masked arrays like IntegerArray specially. It could be done with a to_numpy("int64", na_value=tslibs.iNaT).
@TomAugspurger I am interested in working on it. I attempted a quick fix by trying to force ints_to_td64ns to work with the Int64Dtype(), but that lead to other issues :). I'll try a specific case in sequence_to_td64ns and report back. Thanks!
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
Problem description
When converting a
Series
with anInt64
dtype to a timedelta,to_timedelta
fails withPassing a Python list containing a NA value works, as does passing an
Int64
Series that does not contain NA values. The functionality between these cases should be equivalent.Expected Output
pd.to_timedelta()
output returns atimedelta64
Series containing NA values when the input is anInt64
Series containg NA values:Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 3b6915e
python : 3.7.7.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-7634-generic
Version : #38
159534531720.04~a8480ad-Ubuntu SMP Wed Jul 22 15:13:45 UTCmachine : x86_64
processor :
byteorder : little
LC_ALL : C.UTF-8
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.2.0.dev0+28.g3b6915ef9
numpy : 1.18.5
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.1
setuptools : 45.2.0.post20200210
Cython : 0.29.21
pytest : 6.0.1
hypothesis : 5.23.11
sphinx : 3.1.1
blosc : None
feather : None
xlsxwriter : 1.3.1
lxml.etree : 4.4.1
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.17.0
pandas_datareader: None
bs4 : 4.9.1
bottleneck : 1.3.2
fsspec : 0.8.0
fastparquet : 0.4.1
gcsfs : 0.6.2
matplotlib : 3.2.1
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.4
pandas_gbq : None
pyarrow : 0.16.0
pytables : None
pyxlsb : None
s3fs : 0.4.2
scipy : 1.5.2
sqlalchemy : 1.3.18
tables : 3.6.1
tabulate : 0.8.7
xarray : 0.16.0
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.50.1
The text was updated successfully, but these errors were encountered: