seismometer.data.pandas_helpers.post_process_event

seismometer.data.pandas_helpers.post_process_event(dataframe, label_col, time_col, *, column_dtype='float', impute_val_with_time=1, impute_val_no_time=0)

Infers and casts events.

Default assumptions are for binary classifications (cast as float to maximize compatibility with analyes). A row that does not have any documentation of an event defaults to a negative (0) label - impute_val_no_time. A row that has a timestamp but no event value defaults to a positive (1) label - impute_val_with_time.

Parameters:
  • dataframe (pd.DataFrame) – The dataframe to modify.

  • label_col (str) – The column specifying the value to infer.

  • time_col (time_col) – The time column associated with the value to infer.

  • column_dtype (str) – The data type to cast the label column to, done after imputation; by default ‘float’.

  • impute_val_with_time (Optional[Number|str], optional) – The value to impute for the label if timestamp exist, defaults to 1.

  • impute_val_no_time (Optional[Number|str], optional) – The value to impute for the label if timestamp exist, defaults to 0.

Returns:

The dataframe with potentially modified labels.

Return type:

pd.DataFrame