Ap1712
Ap1712

Reputation: 43

How to plot a displot for a single row and all columns

I have a data frame with n columns and only one row. I want to plot the distribution of the values for a complete row. Below is my data frame with different columns and only one row.

      O13   O117     O5    O31    O49    O58    O70   O103    O10    O69  ...  \
0  83.0  147.0  195.0  170.0  216.0  237.0  334.0  386.0  253.0  414.0

Can someone please help me to know how can i plot a distribution plot for all the values in a row in a single plot.

Upvotes: 1

Views: 147

Answers (1)

Rob Raymond
Rob Raymond

Reputation: 31166

just transpose your dataframe.

import seaborn as sns
df = pd.read_csv(io.StringIO("""      O13   O117     O5    O31    O49    O58    O70   O103    O10    O69  ...  
0  83.0  147.0  195.0  170.0  216.0  237.0  334.0  386.0  253.0  414.0"""), sep="\s+")

sns.displot(df.T)

Upvotes: 1

Related Questions