|
@@ -69,6 +69,16 @@ class DataIntegrityOfSecondAnalyst(AnalystNotFilter):
|
|
|
plot_res = pd.concat([plot_res, group], axis=0, sort=False)
|
|
|
|
|
|
return plot_res
|
|
|
+
|
|
|
+ def get_time_space(self,df, time_str):
|
|
|
+ """
|
|
|
+ :return: 查询时间间隔(单位:秒)
|
|
|
+ """
|
|
|
+ df1 = pd.DataFrame(df[time_str])
|
|
|
+ df1['chazhi'] = df1[time_str].shift(-1) - df1[time_str]
|
|
|
+ result = df1.sample(int(df1.shape[0] / 100))['chazhi'].value_counts().idxmax().seconds
|
|
|
+ del df1
|
|
|
+ return result
|
|
|
|
|
|
def dataIntegrityByMonth(self, dataFrameMerge: pd.DataFrame, conf: Contract, Field_NameOfTurbine):
|
|
|
grouped = dataFrameMerge.groupby([dataFrameMerge.loc[:, Field_Time].dt.year.rename('year'),
|
|
@@ -77,8 +87,10 @@ class DataIntegrityOfSecondAnalyst(AnalystNotFilter):
|
|
|
dataFrameMerge.loc[:, Field_NameOfTurbine]]).agg({'count'})[Field_Time].rename({'count': '长度'}, axis=1)
|
|
|
|
|
|
new_frame = grouped.reset_index('month')
|
|
|
- timeGranularity = self.dataTransfer[self.dataTransfer[Field_TransferType] == Const_TimeGranularity_Second][Field_TimeGranularity].iloc[0] if self.typeAnalyst(
|
|
|
- ) == "data_integrity_second" else self.dataTransfer[self.dataTransfer[Field_TransferType] == Const_TimeGranularity_Minute][Field_TimeGranularity].iloc[0]
|
|
|
+ # timeGranularity = self.dataTransfer[self.dataTransfer[Field_TransferType] == Const_TimeGranularity_Second][Field_TimeGranularity].iloc[0] if self.typeAnalyst(
|
|
|
+ # ) == "data_integrity_second" else self.dataTransfer[self.dataTransfer[Field_TransferType] == Const_TimeGranularity_Minute][Field_TimeGranularity].iloc[0]
|
|
|
+ timeGranularity=self.get_time_space(dataFrameMerge,Field_Time)
|
|
|
+ self.logger.info(f"{self.typeAnalyst()} timeGranularity-->{timeGranularity}")
|
|
|
|
|
|
new_frame = new_frame.reset_index()
|
|
|
|