Skip to content
Advertisement

Is there a way to visualise time series data in such a way that on x-axis i get ticks in year-month format in python?

I am trying to plot a data of stock close price for each day but on the x-axis, i get no labels on xtick instead of year-month format

I tried to take the “Date” and “Close Price” column in a separate dataframe and then tried plotting them.

I have dataframe similar to this

JavaScript
JavaScript

Advertisement

Answer

Just covert it with pandas to_datetime() function

JavaScript

enter image description here

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement