0

I have a dataframe that looks like this:

df_vspd=df.ix[:,['VSPD1','VSPD2','VSPD3','VSPD4','VSPD5','VSPD6','VSPD7']]
df_vspd.head()


   VSPD1  VSPD2  VSPD3  VSPD4  VSPD5  VSPD6  VSPD7
0    NaN    NaN    NaN    NaN    NaN    NaN    NaN
1  21343  37140  30776  12961   1934     14      0
2   6428   9526   9760  12075   4262      0      0
3  11795  14188  16702  18917    612      0      0
4  43571  60684  41611  12168  11264     79      0

I would like to plot a histogram of the data. However I want to stack the columns and do the histogram. Seems like a simple task, however I can not do it!! Help please

What I want to do is stack the columns (VSPD1-VSPD7), and make them the index column. I tried:

cnames = list(df_vspd.columns)
df_test = df_vspd.set_index(cnames).

However it does not do me any good.

3
  • My simple idea is to pass a list of the column names to the pandas set_index function and then do the plot. But I'm not capable! Commented Aug 27, 2013 at 11:59
  • You should update the question with the code you tried out, cause it will probably be closed. SO rules. Commented Aug 27, 2013 at 12:08
  • I have included the dataframe above. What I want to do is stack the columns (VSPD1-VSPD7), and make them the index column. I tried: cnames=list(df_vspd.columns) df_test=df_vspd.set_index(cnames). However it does not do me any good. Commented Aug 27, 2013 at 12:12

1 Answer 1

1

Do you want:

df_vspd.stack(0).hist()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.