|
@@ -140,6 +140,10 @@ class GeneratorSpeedPowerAnalyst(AnalystWithGoodPoint):
|
|
|
|
|
|
print(dataFrame[Field_UnixYearMonth].head())
|
|
|
print(dataFrame[Field_UnixYearMonth].dtype)
|
|
|
+
|
|
|
+ n_dataFrame = pd.DataFrame({
|
|
|
+ 'DateTime': pd.to_datetime(dataFrame[Field_UnixYearMonth], unit='s').dt.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
+ })
|
|
|
# 使用 apply() 对每个元素调用 datetime.fromtimestamp
|
|
|
dataFrame[Field_UnixYearMonth]= dataFrame[Field_UnixYearMonth].apply(lambda x: datetime.fromtimestamp(x).strftime('%Y-%m'))
|
|
|
# 构建最终的JSON对象
|
|
@@ -155,7 +159,7 @@ class GeneratorSpeedPowerAnalyst(AnalystWithGoodPoint):
|
|
|
"title":f' 月度发电机转速功率散点图:{name[0]}',
|
|
|
"xData": dataFrame[Field_GeneratorSpeed].tolist(),
|
|
|
"yData":dataFrame[Field_ActiverPower].tolist(),
|
|
|
- "timeData": dataFrame[Field_UnixYearMonth].tolist(),
|
|
|
+ "timeData": n_dataFrame['DateTime'].tolist(),
|
|
|
"color": dataFrame[Field_UnixYearMonth].tolist(),
|
|
|
"colorbartitle": "时间",
|
|
|
"mode":'markers'
|