1

I want to plot a linear distribution with the following data (Employee, and days for months(1 for January and so on. To get the data into the right form, I transpose it. But I don't know how to access the x-Parameter for plotting.

df=pd.DataFrame({'Empl': ['Jon','Don','Joe'], '1': [40, 50, 10], '2': [20,45,5], '3': [15,0,2], '4': [0,0,0]})
df_T = df.set_index('Empl').T
display(df)
display(df_T)

The output of the two dataframes is:

enter image description here

And now I don't know how to plot/ access the 1st column in the dataframe to set the first param of the plt.plot function:

plt.plot( '???', 'Empl', data=df_T, marker='o', markerfacecolor='blue', markersize=12, color='skyblue', linewidth=4)

thank you very much

mischi
  • 25
  • 9
  • 3
    Does this answer your question? [Selecting multiple columns in a pandas dataframe](https://stackoverflow.com/questions/11285613/selecting-multiple-columns-in-a-pandas-dataframe) – tianlinhe Apr 24 '20 at 07:15

1 Answers1

1

First column is index, so is possible use DataFrame.plot:

df_T.plot( marker='o', markerfacecolor='blue', markersize=12, color='skyblue', linewidth=4)
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252