src.toolbox.utils.time#

Functions#

safe_median_datetime(→ numpy.datetime64)

Safely compute the median of datetime64[ns] array using pandas.

add_datetime_secondary_xaxis(ax[, position, rotation])

Add a secondary datetime x-axis (on top) that mirrors the main x-axis ticks and labels.

Module Contents#

src.toolbox.utils.time.safe_median_datetime(x: numpy.ndarray, axis=None, **kwargs) numpy.datetime64[source]#

Safely compute the median of datetime64[ns] array using pandas.

Parameters:

x (np.ndarray) – A 1D array of datetime64 values.

Returns:

Median datetime or NaT if input is empty/all-NaT.

Return type:

np.datetime64

src.toolbox.utils.time.add_datetime_secondary_xaxis(ax, position='top', rotation=45)[source]#

Add a secondary datetime x-axis (on top) that mirrors the main x-axis ticks and labels.