0

I have a stock price time series data on a one-minute level frequency which I have loaded in in a pandas data frame and converted time index to DateTime index. when I plot prices I get a straight line in between the plot. but when I convert time index to string index then prices are plotted smoothly.

for a given day close prices are available from 9:15 am to 3:30 pm

this is the snapshot of Data Frame enter image description here

this snapshot of the index of the data frame enter image description here

if i plot close prices with datetime index this is how it comes intraday_time_series_data.loc[:,["Close"]].plot() enter image description here

now I change index dtype to string from DateTime index and plot close price comming smoothly enter image description here

so how do I get the plot smoothly without converting DateTime index to string index

sahil
  • 133
  • 1
  • 1
  • 6
  • As long as you have DateTimes you will always lack the night-time data, since -- as you said -- "day close prices are available from 9:15 am to 3:30 pm". So what should the x-axis of your plot correspond to, in your opinion? Time with gaps? The second plot implies a continuous set of data as a function of time, which it is not. – mcsoini Feb 08 '21 at 10:18
  • Have you tried using `date_format()`? – LoukasPap Feb 08 '21 at 10:22

0 Answers0