Skip to content Skip to sidebar Skip to footer

Converting A List Of Datetime Objects Using Drange To Plot In Matplotlib Gives An Error

I have a list of datetime objects which I want to eventually plot within a set range. However when I define this range using drange, I get an error 'ValueError: Number of samples,

Solution 1:

I see that end is less than start but delta is positive. drange works like range. It expects to begin with start and change it by amount delta until it reaches end. I suspect that you should be using -delta in this statement.

As suggested by ImportanceOfBeingErnest in a comment, you could define y_data using:

y_data = range(len(dates))

Post a Comment for "Converting A List Of Datetime Objects Using Drange To Plot In Matplotlib Gives An Error"