Skip to content

Commit

Permalink
TST: confirm bug in partial string multi-index slicing is fixed (GH12…
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche authored Jul 5, 2016
1 parent f20b41e commit 6625367
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit 6625367

Please sign in to comment.