I have a dataframe as below:
I wish to plot date in x axis with a list that has exactly the number of date values as in the table and the record count for that date in y axis.
The code I am using (as shown below) gives the following syntax error:
File "<ipython-input-48-192c9d0a3a14>", line 5
b==Rec_Cnt_BD010['Record_Count_BD010']
^
SyntaxError: invalid syntax
Any help is sincerely appreciated!
xaxisint=[202101,202102,202103,202104,202105,202106,202107,202108,202109,202110,202111,202112,202201,202202,202203,202204,202205,
202206,202207,202208,202209,202210,202211,202212]
a==Rec_Cnt_BD010['Process']
b==Rec_Cnt_BD010['Record_Count_BD010']
ax=plt.axes()
plt.plot(a,b, kind='line', color='r', marker='x')
ax.set_xticks(xaxisint)
plt.axhline(y = Rec_Cnt_BD010[b].mean(), color = 'b', linestyle = '--', label='Mean')
plt.grid(True)
plt.xlabel('Date')
plt.ylabel('Record Count for BD010')
plt.legend()
plt.show()
source https://stackoverflow.com/questions/75821604/setting-x-axis-interval-with-categorical-date-variable
Comments
Post a Comment