I have the following dataframe:
When I plot this, I get the following:
But what I want is that the values of all the columns should be appended to one single columns so that I can obtain just one single line.
I mean, there should be no column number 4,5,6,7. Just one single column with the values of all these.
My Problem:
- Not able to convert Index from month names to 0,1,2,3,. I have used Set_Index but it didnt work
- Used Append command with drop index but didn’t get any results.
I m just one day old in learning pandas. Kindly give me lead.
>Solution :
Try:
single_column_frame = pd.concat([df[col] for col in df.columns])
If you want to get rid of month names as well:
single_column_frame = single_column_frame.reset_index().drop(columns=['index'])
You can also do:
single_column_frame = df.stack().reset_index().loc[:,0]

