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
As a general rule I would expect that index.get_indexer(as + bs) == np.concat([index.get_indexer(as), index.get_indexer(bs)]) for any lists as and bs, i.e. index.get_indexer operates elementwise. However in this case the type of a previous argument is surprisingly affecting the index that is assigned to a later one.
Expected Output
[0, 1] in both cases
Output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit : None
python : 3.8.2.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 63 Stepping 2, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United Kingdom.936
dsaxton
added
Index
Related to the Index class or subclasses
and removed
Needs Triage
Issue that has not been reviewed by a pandas team member
labels
Apr 23, 2020
@batterseapower Thanks, the issue is on master as well and appears to be caused by a bug in the type inference for Index itself:
[ins] In [21]: pd.Index([datetime.date(2020, 4, 20), pd.Timestamp("2020-04-21")]).inferred_typeOut[21]: 'date'
[ins] In [22]: pd.Index([pd.Timestamp("2020-04-21"), datetime.date(2020, 4, 20)]).inferred_typeOut[22]: 'mixed'
I think fixing that would make get_indexer work as expected (if you try just changing the order of the list in the original example it should give the right output).
Code Sample, a copy-pastable example
Problem description
As a general rule I would expect that
index.get_indexer(as + bs) == np.concat([index.get_indexer(as), index.get_indexer(bs)])
for any listsas
andbs
, i.e.index.get_indexer
operates elementwise. However in this case the type of a previous argument is surprisingly affecting the index that is assigned to a later one.Expected Output
[0, 1]
in both casesOutput of
pd.show_versions()
pandas : 1.0.3
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 46.1.3.post20200330
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: