Next there is a two-level DataFrame MultiIndex, namely, cityand date:
temp
count
city date
SFO 2014-05-31 31
2014-06-30 30
2014-07-31 31
2014-08-31 31
2014-09-30 30
YYZ 2014-05-31 31
2014-06-30 30
2014-07-31 31
2014-08-31 31
2014-09-30 30
I want to lose 2014-05-31and 2014-09-30with the level of choice.
How to do it?
Comment: To build a DataFrame -
df = pd.DataFrame(
{('temp', 'count'): {('SFO', Timestamp('2014-05-31 00:00:00')): 31,
('SFO', Timestamp('2014-06-30 00:00:00')): 30,
('SFO', Timestamp('2014-07-31 00:00:00')): 31,
('SFO', Timestamp('2014-08-31 00:00:00')): 31,
('SFO', Timestamp('2014-09-30 00:00:00')): 30,
('YYZ', Timestamp('2014-05-31 00:00:00')): 31,
('YYZ', Timestamp('2014-06-30 00:00:00')): 30,
('YYZ', Timestamp('2014-07-31 00:00:00')): 31,
('YYZ', Timestamp('2014-08-31 00:00:00')): 31,
('YYZ', Timestamp('2014-09-30 00:00:00')): 30}}
).rename_axis(['city','date'])
source
share