Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filter1 = cars.index.get_level_values('model_year') == 76
- filter2 = cars.index.get_level_values('origin') == 'japan'
- cars.loc[filter1 & filter2]
- ##############################################################
- cars.query('model_year == 75')
- ##############################################################
- cars.loc[([77,79], "japan"), ["mpg", "name"]]
- ###############################################################
- cars = cars.swaplevel().sort_index(ascending = True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement