msticpy.common.data_utils module

Data utility functions.

msticpy.common.data_utils.df_has_data(data) bool

Return true if data is a pd.DataFrame and is not empty.

msticpy.common.data_utils.ensure_df_datetimes(data: DataFrame, columns: List[str] | str | None = None, add_utc_tz: bool = True) DataFrame

Return dataframe with converted TZ-aware timestamps.

  • data (pd.DataFrame) – Input dataframe

  • columns (Union[str, List[str], None], optional) – column (str) or list of columns to convert, by default None. If this parameter is not supplied then any column containing the substring “time” is used as a candidate for conversion.

  • add_utc_tz (bool, optional) – If True any datetime columns in the columns parameter ( (or default ‘.*time.*’ columns) that are timezone-naive, will be converted to Timezone-aware timestamps marked as UTC.


Converted DataFrame.

Return type: