Reputation: 43
Quarter is seasonal data, such as '2009Q1','2010Q4'... Size is a float data, such as '12.1', '14.3' ... The data type is as below:
Quarter object
Size float64
While I try to plot these two columns, there is an error:
plt.plot('Quarter','Size')
plt.show()
Error:
ValueError: Unrecognized character S in format string
Does it mean I need to transfer the season data to another format? I do not know how to change the type. Thanks!
Upvotes: 1
Views: 21450
Reputation: 582
To plot your data, you have to pass the variables into the function parameters, whereas you are passing strings that are the same as the variable names. To plot the actual data:
// this
plot(Quarter, Size)
// NOT this
plot('Quarter', 'Size')
To use the axis labels, you have to run plot
like:
plot('xlabel', 'ylabel', data=obj)
Just put your data object into the function and it should plot it how you like. Otherwise look here for documentation on plotting.
Upvotes: 3