Description
A small, complete example of the issue
======================================================================
FAIL: test_nat (pandas.tseries.tests.test_base.TestDatetimeIndexOps)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/matt/pandas-mattrijk/pandas/tseries/tests/test_base.py", line 878, in test_nat
tm.assert_numpy_array_equal(idx._nan_idxs, np.array([], dtype=np.int64))
File "/home/matt/pandas-mattrijk/pandas/util/testing.py", line 1084, in assert_numpy_array_equal
assert_attr_equal('dtype', left, right, obj=obj)
File "/home/matt/pandas-mattrijk/pandas/util/testing.py", line 878, in assert_attr_equal
left_attr, right_attr)
File "/home/matt/pandas-mattrijk/pandas/util/testing.py", line 1019, in raise_assert_detail
raise AssertionError(msg)
AssertionError: numpy array are different
Attribute "dtype" are different
[left]: int32
[right]: int64
----------------------------------------------------------------------
Ran 92 tests in 3.580s
FAILED (failures=1)
Process finished with exit code 0
Expected Output
failing test
idx = pd.DatetimeIndex(['2011-01-01', '2011-01-02'], tz=tz)
tm.assert_numpy_array_equal(idx._nan_idxs, np.array([], dtype=np.int64))
idx = pd.DatetimeIndex(['2011-01-01', 'NaT'], tz=tz)
tm.assert_numpy_array_equal(idx._nan_idxs, np.array([1], dtype=np.int64))
test passes
tm.assert_numpy_array_equal(idx._nan_idxs, np.array([], dtype=np.int32))
In Ipython on 32bit the values look fine.
In [3]: idx = pd.DatetimeIndex(['2016-01-01', 'NaT'], tz=None)
In [4]: idx.dtype
Out[4]: dtype('<M8[ns]')
In [5]: idx._nan_idxs
Out[5]: array([], dtype=int64)
In [6]: arry = np.array([], dtype=np.int64)
In [7]: arry
Out[7]: array([], dtype=int64)
In [8]: import pandas.util.testing as tm
In [9]: tm.assert_numpy_array_equal(idx._nan_idxs, arry))
Out[9]: True
This fixes it but I think theres more going on.
import platform
if platform.architecture()[0] == '32bit':
tm.assert_numpy_array_equal(idx._nan_idxs, np.array([], dtype=np.int32))
else:
tm.assert_numpy_array_equal(idx._nan_idxs, np.array([], dtype=np.int64))
Output of pd.show_versions()
commit: None
python: 2.7.12.final.0
python-bits: 32
OS: Linux
OS-release: 3.13.0-92-generic
machine: i686
processor: i686
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.19.0
nose: 1.3.7
pip: 8.1.2
setuptools: 27.2.0
Cython: 0.24.1
numpy: 1.11.1
scipy: 0.18.1
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: 1.4.6
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: 1.1.0
tables: 3.2.3.1
numexpr: 2.6.1
matplotlib: 1.5.3
openpyxl: 2.4.0
xlrd: 1.0.0
xlwt: 1.1.2
xlsxwriter: 0.9.3
lxml: 3.6.4
bs4: 4.3.2
html5lib: 0.999
httplib2: None
apiclient: None
sqlalchemy: 1.0.13
pymysql: 0.7.6.None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: 0.2.1