flasc.data_processing.dataframe_manipulations.df_find_and_fill_data_gaps_with_missing

flasc.data_processing.dataframe_manipulations.df_find_and_fill_data_gaps_with_missing#

flasc.data_processing.dataframe_manipulations.df_find_and_fill_data_gaps_with_missing(df: DataFrame | FlascDataFrame, missing_data_buffer: float = 5.0) DataFrame | FlascDataFrame[source]#

Find and fill data gap and mark as missing data with NaN.

This function takes a pd.DataFrame object and look for large jumps in

the 'time' column. Rather than simply interpolating these values using a ZOH, this rather indicates that measurements are missing. Hence, this function finds these time gaps and inserts an additional row extra 1 second after the start of the time gap with all 'nan' values. This way, the data gap becomes populated with 'nan' values and the data will be ignored in any further analysis.

Parameters:
  • df (pd.Dataframe | FlascDataFrame) -- Merged dataframe for all imported files

  • missing_data_buffer (float, optional) -- If the time gaps are equal or larger than this limit [s], then it will consider the data as corrupted or missing. Defaults to 10.

Returns:

The postprocessed dataframe where all data

within large time gaps hold value 'missing'.

Return type:

pd.Dataframe | FlascDataFrame