girijesh96
girijesh96

Reputation: 455

Python graph plot issue

I am trying to plot a time-series data, but I'm facing some issue while plotting them like when I'm using function

pyplot.plot(ts)

graph is like

first plot using function

But when I'm using following function of python on same data then graph is like this

ts.plot()

second graph

I'm totally confused because of this. Any idea about this error?

Upvotes: 0

Views: 96

Answers (1)

Joe
Joe

Reputation: 12417

Without the df, I can only make a guess. You should order the column which contains the dates. Try to apply this to the column of x-axis where the dates are:

df = df.sort_values(by='your_column') #'your_column' is the columns with dates

Upvotes: 1

Related Questions