assert_df

hhpy.ds.assert_df(df: Any, groupby: Union[Sequence[T_co], int, float, str, bytes, None, AbstractSet[T_co], bool] = False, name: str = 'df') → Union[pandas.core.frame.DataFrame, Tuple[pandas.core.frame.DataFrame, List[T]]][source]

assert that input is a pandas DataFrame, raise ValueError if it cannot be cast to DataFrame

Parameters:
  • df – Object to be cast to DataFrame
  • groupby – column to use as groupby
  • name – name to use in the ValueError message, useful when calling from another function
Returns:

pandas DataFrame