Description
Code Sample, a copy-pastable example if possible
In [2]: idx = pd.DatetimeIndex(['2012-02-01', '2012-02-02']).append(pd.Index(['not date']))[:2]
In [3]: idx.get_indexer_non_unique(['2012-02-01'])
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-df568b5df150> in <module>()
----> 1 idx.get_indexer_non_unique(['2012-02-01'])
/home/pietro/nobackup/repo/pandas/pandas/core/indexes/base.py in get_indexer_non_unique(self, target)
2797
2798 if self.is_all_dates:
-> 2799 self = Index(self.asi8)
2800 tgt_values = target.asi8
2801 else:
/home/pietro/nobackup/repo/pandas/pandas/core/indexes/base.py in __new__(cls, data, dtype, copy, name, fastpath, tupleize_cols, **kwargs)
351 **kwargs)
352 elif data is None or is_scalar(data):
--> 353 cls._scalar_data_error(data)
354 else:
355 if tupleize_cols and is_list_like(data) and data:
/home/pietro/nobackup/repo/pandas/pandas/core/indexes/base.py in _scalar_data_error(cls, data)
702 raise TypeError('{0}(...) must be called with a collection of some '
703 'kind, {1} was passed'.format(cls.__name__,
--> 704 repr(data)))
705
706 @classmethod
TypeError: Index(...) must be called with a collection of some kind, None was passed
Problem description
Not a great example, but this can bite more reasonable code. It is due to the fact that asi8
is used on a non-DatetimeIndex
. In fact, asi8
should really disappear in the non-datetime-specific parts of the code base.
Expected Output
(array([0]), array([]))
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.9.0-5-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8
pandas: 0.22.0.dev0+448.gdbec3c92e
pytest: 3.0.6
pip: 9.0.1
setuptools: 33.1.1
Cython: 0.25.2
numpy: 1.12.1
scipy: 0.18.1
pyarrow: None
xarray: None
IPython: 5.2.2
sphinx: None
patsy: 0.4.1+dev
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: 1.2.0
tables: 3.3.0
numexpr: 2.6.1
feather: 0.3.1
matplotlib: 2.0.0
openpyxl: 2.3.0
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: None
lxml: 3.7.1
bs4: 4.5.3
html5lib: 0.999999999
sqlalchemy: 1.0.15
pymysql: None
psycopg2: None
jinja2: 2.8
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None