C:\Users\1\PycharmProjects\pythonProject1\.venv\Scripts\python.exe C:\Users\1\PycharmProjects\pythonProject1\future.py
找到文件: 光伏
找到文件: 风能
找到文件: 日前电价
找到文件: 高压负荷
找到文件: 实时电价
找到文件: 气象
正在读取数据文件...
成功读取: 光伏,数据形状: (2880, 2)
光伏数据样例:
DATA_TIME DATA_VALUE_光伏
0 2025-01-01 00:00:00 -0.054
1 2025-01-01 01:00:00 -0.054
--------------------------------------------------
成功读取: 风能,数据形状: (2880, 2)
风能数据样例:
DATA_TIME DATA_VALUE_风能
0 2025-01-01 00:00:00 77.7221
1 2025-01-01 01:00:00 41.9552
--------------------------------------------------
成功读取: 日前电价,数据形状: (9888, 3)
日前电价数据样例:
时间 价格 开停
0 2025-01-01 00:15:00 377.0 开
1 2025-01-01 00:30:00 372.0 开
--------------------------------------------------
成功读取: 高压负荷,数据形状: (35712, 2)
高压负荷数据样例:
DATA_TIME DATA_VALUE
0 2025-03-01 00:00:00 -429.9219
1 2025-03-01 00:05:00 -456.6538
--------------------------------------------------
成功读取: 实时电价,数据形状: (9888, 2)
实时电价数据样例:
时间 价格
0 2025-01-01 00:15:00 377.0
1 2025-01-01 00:30:00 372.0
--------------------------------------------------
成功读取: 气象,数据形状: (3181, 8)
气象数据样例:
DATA_TIME TEMPERATURE ... SUNLIGHT_INTENSITY ISOBARIC
0 2025-01-01 00:00:00 -1.0 ... NaN NaN
1 2025-01-01 01:00:00 -1.0 ... NaN NaN
[2 rows x 8 columns]
--------------------------------------------------
清洗 光伏 数据...
缺失值处理报告:
DATA_VALUE_光伏: 1个缺失值已处理
异常值处理报告:
DATA_VALUE_光伏: 45个异常值已处理
光伏 清洗完成,处理后形状: (2880, 2)
清洗 风能 数据...
风能 清洗完成,处理后形状: (2880, 2)
清洗 日前电价 数据...
异常值处理报告:
价格: 248个异常值已处理
日前电价 清洗完成,处理后形状: (9888, 3)
清洗 高压负荷 数据...
高压负荷 清洗完成,处理后形状: (35712, 2)
清洗 实时电价 数据...
异常值处理报告:
价格: 301个异常值已处理
实时电价 清洗完成,处理后形状: (9888, 2)
清洗 气象 数据...
缺失值处理报告:
WIND_DIRECTION: 113个缺失值已处理
SUNLIGHT_INTENSITY: 113个缺失值已处理
ISOBARIC: 113个缺失值已处理
异常值处理报告:
WIND_SPEED: 112个异常值已处理
WIND_DIRECTION: 257个异常值已处理
HUMIDITY: 140个异常值已处理
ISOBARIC: 24个异常值已处理
气象 清洗完成,处理后形状: (3181, 8)
整合数据...
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:77: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(mode_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
C:\Users\1\PycharmProjects\pythonProject1\future.py:73: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df[col].fillna(median_val, inplace=True)
合并后数据形状: (9888, 14)
合并后数据列名: ['时间', '价格_实时', '价格_日前', '竞价状态', 'DATA_VALUE_光伏', 'DATA_VALUE_风能', 'DATA_VALUE', 'TEMPERATURE', 'WIND_SPEED', 'WIND_DIRECTION', 'HUMIDITY', 'RAIN_RATE', 'SUNLIGHT_INTENSITY', 'ISOBARIC']
进行描述性分析...
基本统计量已保存至 analysis_results/基本统计量.csv
Traceback (most recent call last):
File "C:\Users\1\PycharmProjects\pythonProject1\.venv\Lib\site-packages\pandas\core\indexes\base.py", line 3812, in get_loc
return self._engine.get_loc(casted_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pandas/_libs/index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 7096, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: '实时电价'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\1\PycharmProjects\pythonProject1\future.py", line 184, in <module>
plt.plot(merged["时间"], merged["实时电价"], label="实时电价", alpha=0.7)
~~~~~~^^^^^^^^^^^^
File "C:\Users\1\PycharmProjects\pythonProject1\.venv\Lib\site-packages\pandas\core\frame.py", line 4113, in __getitem__
indexer = self.columns.get_loc(key)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\1\PycharmProjects\pythonProject1\.venv\Lib\site-packages\pandas\core\indexes\base.py", line 3819, in get_loc
raise KeyError(key) from err
KeyError: '实时电价'
最新发布