Can you please provide this part of your code Because here in example we use 'EST' in dataframe and see the same on the graph
from datetime import datetime, timedelta
import pytz
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
pd.set_option("display.max_columns", None)
pd.set_option("display.width", None)
def create_sample_data():
est = pytz.timezone('EST')
start_date = est.localize(datetime(2024, 1, 1, 9, 0, 0))
dates = [start_date + timedelta(hours=i) for i in range(100)]
data = pd.DataFrame({
"Datetime": dates,
'Open': np.random.randn(100).cumsum() + 100,
'High': np.random.randn(100).cumsum() + 102,
'Low': np.random.randn(100).cumsum() + 98,
'Close': np.random.randn(100).cumsum() + 100,
'Volume': np.random.randint(1000, 10000, 100)
})
data.set_index('Datetime', inplace=True)
return data
if __name__ == '__main__':
df = create_sample_data()
print(df.head())
df["Open"].plot()
plt.show()
Open High Low Close Volume
Datetime
2024-01-01 09:00:00-05:00 100.112783 102.718745 97.327823 100.718963 4473
2024-01-01 10:00:00-05:00 101.082608 104.173274 96.920105 101.971678 8605
2024-01-01 11:00:00-05:00 103.168035 105.240899 95.465495 103.051083 9213
2024-01-01 12:00:00-05:00 103.517523 104.591967 95.903017 101.958344 7818
2024-01-01 13:00:00-05:00 102.138308 105.277195 96.024361 100.904891 1400