Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import matplotlib.pyplot as plt
- file_path = 'TESLA.csv'
- df = pd.read_csv(file_path)
- start_index = 0
- df_subset = df.iloc[start_index:start_index+10]
- # df_subset['Date'] = pd.to_datetime(df_subset['Date'])
- df_subset.loc[:, 'Date'] = pd.to_datetime(df_subset['Date'], format='%m/%d/%y')
- x = df_subset['Date']
- y = df_subset['Open']
- # plt.bar(x, y, color='g')
- plt.plot(x, y, marker='o', linestyle='--', color='b')
- plt.xlabel('Date')
- plt.ylabel('Open Price in $')
- plt.title('Open Prices for the First 10 Days of Tesla Stock Market')
- plt.xticks(rotation=45)
- plt.tight_layout()
- plt.grid()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement