I have the data frame:
I want to plot the date column vs the close column.
Here is the code to do that:
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv('C:/Users/admin/Desktop/ohlcv.csv')
df['date']=pd.to_datetime(df['date'])
df=df.set_index('date')
plt.figure(figsize=(12.5,4.5))
plt.title('Close Price Variation')
plt.xlabel('date')
plt.ylabel('close')
plt.plot(df.close)
plt.show()
This gives the plot as shown:
The issue is that the timestamp in the original plot is not the same as in the dataframe. What I mean by this is that data in the dataframe is spaced by 15 mins interval while in plot is spaced in 1 min interval
How can I get the same timestamp in the plot and in the dataframe