Bug when assigning timedelta64 to a series (or dataframe) with an indexer · Issue #14155 · pandas-dev/pandas (original) (raw)
Code Sample, a copy-pastable example if possible
In [2]: import pandas as pd
In [3]: import numpy as np
In [4]: s = pd.Series(10*[np.timedelta64(10, 'm')])
In [5]: s
Out[5]:
0 00:10:00
1 00:10:00
2 00:10:00
3 00:10:00
4 00:10:00
5 00:10:00
6 00:10:00
7 00:10:00
8 00:10:00
9 00:10:00
dtype: timedelta64[ns]
In [6]: s.ix[[1,2,3]] = np.timedelta64(20, 'm')
In [7]: s
Out[7]:
0 00:10:00
1 00:00:00.000000
2 00:00:00.000000
3 00:00:00.000000
4 00:10:00
5 00:10:00
6 00:10:00
7 00:10:00
8 00:10:00
9 00:10:00
dtype: timedelta64[ns]
Expected Output
In [7]: s
Out[7]:
0 00:10:00
1 00:20:00
2 00:20:00
3 00:20:00
4 00:10:00
5 00:10:00
6 00:10:00
7 00:10:00
8 00:10:00
9 00:10:00
dtype: timedelta64[ns]
output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.5.0.final.0
python-bits: 64
OS: Darwin
OS-release: 14.0.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 18.2
Cython: 0.24.1
numpy: 1.11.1
scipy: 0.18.0
statsmodels: None
xarray: None
IPython: 4.0.3
sphinx: 1.4.6
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: 3.2.3.1
numexpr: 2.6.1
matplotlib: 1.5.1
openpyxl: 2.3.3
xlrd: 0.9.4
xlwt: None
xlsxwriter: None
lxml: 3.5.0
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.15
pymysql: 0.7.5.None
psycopg2: None
jinja2: 2.8
boto: 2.42.0
pandas_datareader: None