Partial date string indexing doesn't work on MultiIndex #25165
Labels
Datetime
Datetime data dtype
Enhancement
Indexing
Related to indexing on series/frames, not to indexes themselves
MultiIndex
Milestone
Code Sample, a copy-pastable example if possible
Problem description
For single (not multi-) datetime indexes, you can use a string coercible to a
pd.Timestamp
to slice the dataframe. For MultiIndexes with one level a DatetimeIndex, this indexing is not possible, no matter how precisely you specify the slice axes and levels (and even when the dataframe is sorted by the DatetimeIndex level, and the DatetimeIndex level is the outermost level).Expected Output
df_multi.loc(axis=0)['2019-2':, :]
should certainly slice the rows correctly, asCases more complicated than this might have some caveats, but the example provided above should definitely work.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.1.final.0
python-bits: 64
OS: Windows
OS-release: 2012ServerR2
machine: AMD64
processor: Intel64 Family 6 Model 45 Stepping 2, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.23.4
pytest: 4.0.2
pip: 18.1
setuptools: 40.6.3
Cython: 0.29.2
numpy: 1.15.4
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 7.2.0
sphinx: 1.8.2
patsy: 0.5.1
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.8
feather: None
matplotlib: 3.0.2
openpyxl: 2.5.12
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: 1.1.2
lxml: 4.2.5
bs4: 4.6.3
html5lib: 1.0.1
sqlalchemy: 1.2.15
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: