20 lines
555 B
Python
20 lines
555 B
Python
|
import pandas as pd
|
|||
|
import numpy as np
|
|||
|
|
|||
|
start_date = '2023-01-01'
|
|||
|
end_date = '2024-01-01'
|
|||
|
|
|||
|
# 创建时间索引
|
|||
|
time_index = pd.date_range(start=start_date, end=end_date, freq='15min')
|
|||
|
|
|||
|
# 生成电价数据,假设电价在0.28到0.32欧元/kWh之间波动
|
|||
|
price_data = np.random.uniform(0.28, 0.32, len(time_index))
|
|||
|
|
|||
|
# 创建DataFrame
|
|||
|
price_df = pd.DataFrame(data={'Time': time_index, 'ElectricityPrice': price_data})
|
|||
|
|
|||
|
# 保存到CSV文件
|
|||
|
price_df.to_csv('electricity_price_data.csv', index=False)
|
|||
|
|
|||
|
print("Electricity price data generated and saved.")
|