Home > Net >  How can I make a boxplot for each row of df?
How can I make a boxplot for each row of df?

Time:03-29

I have some data, it looks like:

df = pd.DataFrame({'in1' : [100, 150, 110, 180, 125], 
                   'in2' : [200, 210, 125, 125, 293],
                   'in3' : [50, 35, 200, 100, 180]
                   'a' : [c, d, e, f,g]})

How can I make a boxplot per row of in1 to in3?

CodePudding user response:

Simply type this:

df.T.boxplot()

The pandas.DataFrame.boxplot-method creates a box for each column. You can work around this by using the pandas.DataFrame.T-method which transposes the dataframe (i.e., rows become columns and vice versa).

  • Related