Why am I getting this matplotlib error for plotting a categorical variable?

Viewed 3421

I feel stupid but I cannot seem to fix this error or find any solution online. Why do I keep getting the following error no matter how I try to plot it using matplotlib?

For instance even the following code gives me the same error -

names = list(fig1['day'])
values = list(fig1['count'])
fig, axs = plt.subplots(figsize=(25, 10))
axs.bar(names, values, color='plum')

matplotlib.category: Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.

enter image description here

UPDATE: I found the solution - https://discourse.matplotlib.org/t/why-am-i-getting-this-matplotlib-error-for-plotting-a-categorical-variable/21758/2

0 Answers
Related