Reputation: 2043
I have a dataframe dfWaits like this
waitEvent snapDate gc cr block 3-way gc current block 3-way log file sync
instance
AAA 2015-Jul-01 NaN 2 9
BBB 2015-Jul-01 NaN 2 8
AAA 2015-Jul-03 NaN 1 9
BBB 2015-Jul-03 1 2 8
AAA 2015-Jun-29 NaN 2 8
BBB 2015-Jun-29 NaN 2 8
dfWaits.columns
Index(['snapDate', 'gc cr block 3-way', 'gc current block 3-way',
'log file sync'],
dtype='object', name='waitEvent')
dfWaits.index
Index(['AAA', 'BBB', 'AAA', 'BBB', 'AAA',
'BBB'],
dtype='object', name='instance')
I would want to rename the column waitEvent as instance.
I would also want to draw a matplot lib chart with snapdate on x-axis and gc cr block 3-way,gc current block 3-way and log file sync on the y axis.
I tried this dfWaits.loc['AAA'].plot()
but this gives me instance against x-axis instead of the snapDate.
Upvotes: 0
Views: 316
Reputation: 36545
To get rid of your waitEvent
label (actually a label on your columns), set
df.columns.name=None
For your plot set the snapDate as your index and then call plot()
on the columns you want:
df.index = df.snapDate
df.iloc[:,[2,3,4]].plot()
Upvotes: 1