arthurai.core.util.standardize_pd_obj#

arthurai.core.util.standardize_pd_obj(data, dropna, replacedatetime, attributes=None)#

Standardize pandas object for nans and datetimes.

Standardization includes casting correct type for int columns that are float due to nans and for converting datetime objects into isoformatted strings.

Parameters
  • data (Union[DataFrame, Series]) – the pandas data to standardize

  • dropna (bool) – if True, drop nans from numeric date columns

  • replacedatetime (bool) – if True, replace timestamps with isoformatted strings

  • attributes (Optional[Dict[str, Union[str, ValueType]]]) – if used for sending inferences, will handle column type conversions for columns with any nulls

Return type

Union[DataFrame, Series]

Returns

the standardized pandas data

Raises
  • TypeError – timestamp is not of type datetime.datetime

  • ValueError – timestamp is not timezone aware and no location data is provided to remedy