odsbox.asam_time

datetime is represented as string in ASAM ODS formatted using YYYYMMDDHHMMSSFFF. Here you find some helpers.

Functions

to_pd_timestamp(asam_time)

Convert ASAM ODS datetime string to pandas Timestamp.

from_pd_timestamp(timestamp[, length])

Convert a pandas Timestamp to a string formatted as asamtime (YYYYMMDDHHMMSSFFF).

Module Contents

odsbox.asam_time.to_pd_timestamp(asam_time)[source]

Convert ASAM ODS datetime string to pandas Timestamp.

Parameters:

asam_time (str | None) – ASAM ODS datetime string to be converted. Formatted like YYYYMMDDHHMMSSFFF. It must at least contain YYYYMMDD.

Returns:

Corresponding pandas Timestamp value. For empty string pd.NaT is returned.

Raises:

SyntaxError – If content is invalid.

Return type:

pandas.Timestamp

odsbox.asam_time.from_pd_timestamp(timestamp, length=17)[source]

Convert a pandas Timestamp to a string formatted as asamtime (YYYYMMDDHHMMSSFFF).

Parameters:
  • timestamp (pandas.Timestamp | None) – The pandas Timestamp to convert. The timezone information given in timestamp is ignored.

  • length (int) – The desired length of the output string. The final string will be truncated to the specified length. The maximum is 23 including nanoseconds.

Returns:

The asam time representation of the timestamp. For None or pd.NaT an empty string is returned.

Return type:

str