We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
http://stackoverflow.com/questions/24152509/slicing-a-pandas-multiindex-using-datetime-datatype
dates = pd.DatetimeIndex([datetime.datetime(2012,1,1,12,12,12)+datetime.timedelta(days = i) for i in range(6)]) freq = [1,2] iterables = [dates, freq] index = pd.MultiIndex.from_product(iterables, names=['date','frequency']) df = pd.DataFrame(np.random.randn(6*2,4),index=index,columns=list('ABCD'))
pd.IndexSlice
df_temp = df.loc[(slice(pd.Timestamp('2012-01-01 12:12:12'),pd.Timestamp('2012-01-03 12:12:12'))), slice('A','B')] df_temp.loc[(slice(None),slice(1,1)),:]
After #7430, the following works (just using IndexSlice as a conven)
IndexSlice
idx = pd.IndexSlice df.loc[(idx[pd.Timestamp('2012-01-01 12:12:12'),pd.Timestamp('2012-01-03 12:12:12'),idx[1:1]], idx['A','B']]
as well as partial string slicing
df.loc[idx['2012-01-01 12:12:12':'2012-01-03 12:12:12',1],idx['A':'B']]
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
http://stackoverflow.com/questions/24152509/slicing-a-pandas-multiindex-using-datetime-datatype
pd.IndexSlice
notationAfter #7430, the following works (just using
IndexSlice
as a conven)as well as partial string slicing
The text was updated successfully, but these errors were encountered: