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

1

1 Answer 1

1

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

df_T.plot( marker='o', markerfacecolor='blue', markersize=12, color='skyblue', linewidth=4)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.