Skip to content

TST: confirm bug in partial string multi-index slicing is fixed (GH12685) #13559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pandas/tests/indexes/test_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import re
import warnings

from pandas import (date_range, MultiIndex, Index, CategoricalIndex,
from pandas import (DataFrame, date_range, MultiIndex, Index, CategoricalIndex,
compat)
from pandas.core.common import PerformanceWarning
from pandas.indexes.base import InvalidIndexError
Expand Down Expand Up @@ -2201,6 +2201,15 @@ def test_partial_string_timestamp_multiindex(self):
with assertRaises(KeyError):
df_swap.loc['2016-01-01']

# GH12685 (partial string with daily resolution or below)
dr = date_range('2013-01-01', periods=100, freq='D')
ix = MultiIndex.from_product([dr, ['a', 'b']])
df = DataFrame(np.random.randn(200, 1), columns=['A'], index=ix)

result = df.loc[idx['2013-03':'2013-03', :], :]
expected = df.iloc[118:180]
tm.assert_frame_equal(result, expected)

def test_rangeindex_fallback_coercion_bug(self):
# GH 12893
foo = pd.DataFrame(np.arange(100).reshape((10, 10)))
Expand Down