Reputation: 13510
I have a pandas dataframe which looks like:
A B C D
1 2 3 4
5 6 7 8
9 10 11 12
And I need to plot all three rows and not columns. I know I can use iloc if I want a specific row but looking for something that could plot all rows together:
df.iloc[0]
I have also tried:
df.plot()
which plots columns A,B,... instead of rows.
NOTE: Number of rows is variable for different dataframes and could be up to 200 so I am not interested in setting colors or stuff like that
Upvotes: 5
Views: 9773
Reputation: 38415
You can transpose the dataframe and then plot to plot the rows
df.T.plot()
Upvotes: 10
Reputation: 1187
So, you're plotting columns of data vs rows? Sounds like you need to transpose your dataframe. Use df.T.plot()
Upvotes: 2