import pandas as pd # 读取CSV文件
data = pd.read_csv('stock_data.csv')# 查看前几行数据 print(data.head())
输出结果:
Date Open High Low Close Volume
02023-01-01100.000105.000098.00000104.0000123456712023-01-02104.000107.0000101.0000106.0000234567822023-01-03106.000110.0000104.0000109.0000345678932023-01-04109.000112.0000107.0000111.0000456789042023-01-05111.000115.0000110.0000114.00005678901
Date Open High Low Close Volume
02023-01-01100.000105.000098.00000104.0000123456712023-01-02104.000107.0000101.0000106.0000234567822023-01-03106.000110.0000104.0000109.0000345678932023-01-04109.000112.0000107.0000111.0000456789042023-01-05111.000115.0000110.0000114.00005678901
Date Open High Low Close Volume price_change
02023-01-010.000000.000000-0.0000000.0000000.0000000.00000012023-01-020.000000.000000-0.0000000.0000000.0000000.20000022023-01-030.000000.000000-0.0000000.0000000.0000000.28571432023-01-040.000000.000000-0.0000000.0000000.0000000.27272742023-01-050.000000.000000-0.0000000.0000000.0000000.269231
from sklearn.model_selection
import train_test_split
# 定义特征和目标变量
X = data[['Open','High','Low','Volume','price_change']]
y = data['Close']# 划分数据集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# 查看划分后的数据集大小 print(f"Training set size: {len(X_train)}")print(f"Testing set size: {len(X_test)}")
只需要课程大纲或进度表wokwi 大模型工具,就可以完全掌握嵌入式系统基础实验的所有核心点。 LCD // Learn about the ESP32 WiFi simulation in
// https://docs.wokwi.com/guides/esp32-wifi
https://wokwi.com/projects/321525495180034642#include <WiFi.h>…