import pandas as pd
import matplotlib.pyplot as plt

def split_test():
    # 读取大型数据集
    large_dataset = pd.read_csv("../data/Dataset_test/power/power_test.csv")

    # 将数据集等分为5个较小的数据集
    num_splits = 5
    split_size = len(large_dataset) // num_splits

    small_datasets = []
    for i in range(num_splits):
        start = i * split_size
        end = (i + 1) * split_size if i < num_splits - 1 else len(large_dataset)
        small_datasets.append(large_dataset[start:end])

    # 保存5个较小的数据集为.csv文件
    for i, small_dataset in enumerate(small_datasets):
        small_dataset.to_csv(f"../data/Dataset_test/power/power_dataset_{i + 1}.csv", index=False)


if __name__ == '__main__':
    # 读取Excel文件
    # df = pd.read_excel("./data/nwp1.xlsx")
    #
    # # 计算分段数量
    # num_windows = df.shape[0] // 16
    #
    # # 循环每一个分段
    # for i in range(num_windows):
    #     window = df.iloc[i * 16:(i + 1) * 16,2:-2]
    #     data = window.astype(float)
    #
    #     # 将数据绘制为图像
    #     plt.imshow(data, cmap="gray")
    #
    #     # 保存图像
    #     plt.savefig("./wind/window_{}.png".format(i))
    split_test()