2025-05-06 11:18:48 +08:00
|
|
|
|
import pandas as pd
|
|
|
|
|
# 读取Excel文件
|
2025-06-04 17:04:02 +08:00
|
|
|
|
file_path = "/home/xiazj/ai-station-code/meirejie/data/tar_data.csv" # 替换为你的Excel文件路径
|
2025-05-06 11:18:48 +08:00
|
|
|
|
df = pd.read_csv(file_path)
|
|
|
|
|
# 随机抽取10条数据
|
|
|
|
|
test_set = df.sample(n=10, random_state=1) # random_state保证每次抽样结果相同
|
|
|
|
|
|
|
|
|
|
columns = ['A', 'V', 'FC', 'C', 'H', 'N', 'S', 'O', 'H/C', 'O/C', 'N/C', 'Rt','Hr', 'dp', 'T','Tar']
|
|
|
|
|
test_set = test_set[columns]
|
|
|
|
|
# 保存测试集到新的Excel文件
|
2025-06-04 17:04:02 +08:00
|
|
|
|
test_set.to_csv('/home/xiazj/ai-station-code/meirejie/data/tar_data_test.csv', index=False) # 保存为test_set.xlsx,不保存索引
|
2025-05-06 11:18:48 +08:00
|
|
|
|
print("测试集已保存为 char_data_test.csv")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-04 17:04:02 +08:00
|
|
|
|
file_path = "/home/xiazj/ai-station-code/meirejie/data/gas_data.csv" # 替换为你的Excel文件路径
|
2025-05-06 11:18:48 +08:00
|
|
|
|
df = pd.read_csv(file_path)
|
|
|
|
|
# 随机抽取10条数据
|
|
|
|
|
test_set = df.sample(n=10, random_state=1) # random_state保证每次抽样结果相同
|
|
|
|
|
columns = ['A', 'V', 'FC', 'C', 'H', 'N', 'S', 'O', 'H/C', 'O/C', 'N/C', 'Rt','Hr', 'dp', 'T','Gas']
|
|
|
|
|
test_set = test_set[columns]
|
|
|
|
|
# 保存测试集到新的Excel文件
|
2025-06-04 17:04:02 +08:00
|
|
|
|
test_set.to_csv('/home/xiazj/ai-station-code/meirejie/data/gas_data_test.csv', index=False) # 保存为test_set.xlsx,不保存索引
|
2025-05-06 11:18:48 +08:00
|
|
|
|
|
|
|
|
|
print("测试集已保存为 gas_data_test.csv")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-04 17:04:02 +08:00
|
|
|
|
file_path = "/home/xiazj/ai-station-code/meirejie/data/water_data.csv" # 替换为你的Excel文件路径
|
2025-05-06 11:18:48 +08:00
|
|
|
|
df = pd.read_csv(file_path)
|
|
|
|
|
# 随机抽取10条数据
|
|
|
|
|
test_set = df.sample(n=10, random_state=1) # random_state保证每次抽样结果相同
|
|
|
|
|
columns = ['A', 'V', 'FC', 'C', 'H', 'N', 'S', 'O', 'H/C', 'O/C', 'N/C', 'Rt','Hr', 'dp', 'T','Water']
|
|
|
|
|
test_set = test_set[columns]
|
|
|
|
|
# 保存测试集到新的Excel文件
|
2025-06-04 17:04:02 +08:00
|
|
|
|
test_set.to_csv('/home/xiazj/ai-station-code/meirejie/data/water_data_test.csv', index=False) # 保存为test_set.xlsx,不保存索引
|
2025-05-06 11:18:48 +08:00
|
|
|
|
|
|
|
|
|
print("测试集已保存为 water_data_test.csv")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-04 17:04:02 +08:00
|
|
|
|
file_path = "/home/xiazj/ai-station-code/meirejie/data/char_data.csv" # 替换为你的Excel文件路径
|
2025-05-06 11:18:48 +08:00
|
|
|
|
df = pd.read_csv(file_path)
|
|
|
|
|
# 随机抽取10条数据
|
|
|
|
|
test_set = df.sample(n=10, random_state=1) # random_state保证每次抽样结果相同
|
|
|
|
|
columns = ['A', 'V', 'FC', 'C', 'H', 'N', 'S', 'O', 'H/C', 'O/C', 'N/C', 'Rt','Hr', 'dp', 'T','Char']
|
|
|
|
|
test_set = test_set[columns]
|
|
|
|
|
# 保存测试集到新的Excel文件
|
2025-06-04 17:04:02 +08:00
|
|
|
|
test_set.to_csv('/home/xiazj/ai-station-code/meirejie/data/char_data_test.csv', index=False) # 保存为test_set.xlsx,不保存索引
|
2025-05-06 11:18:48 +08:00
|
|
|
|
|
|
|
|
|
print("测试集已保存为 char_data_test.csv")
|