Untitled

 avatar
unknown
plain_text
a year ago
825 B
4
Indexable
import pandas as pd
import matplotlib.pyplot as plt

# Đọc dữ liệu từ file CSV
df = pd.read_csv('COM_Stock.csv')

# Chọn cột 'open', 'high', 'low', 'close' từ DataFrame
open_prices = df['open']
high_prices = df['high']
low_prices = df['low']
close_prices = df['close']

# Tạo biểu đồ
plt.figure(figsize=(10, 6))
plt.plot(open_prices, label='Open', linewidth=2, color='blue')
plt.plot(high_prices, label='High', linewidth=2, color='green')
plt.plot(low_prices, label='Low', linewidth=2, color='red')
plt.plot(close_prices, label='Close', linewidth=2, color='purple')

# Đặt tên cho các trục và biểu đồ
plt.title('Biểu đồ Open, High, Low, Close của cổ phiếu X')
plt.xlabel('Ngày')
plt.ylabel('Giá')
plt.legend()

# Hiển thị biểu đồ
plt.show()
Editor is loading...
Leave a Comment