pyinterp.core.dateutils.isocalendar

Contents

pyinterp.core.dateutils.isocalendar#

pyinterp.core.dateutils.isocalendar(array: object) → tuple[numpy.ndarray[dtype=int32, shape=(*), order='C'], numpy.ndarray[dtype=uint8, shape=(*), order='C'], numpy.ndarray[dtype=uint8, shape=(*), order='C']]#

Extract the ISO calendar date (year, week number, weekday) from a numpy datetime64 array.

The ISO year consists of 52 or 53 full weeks, and where a week starts on a Monday and ends on a Sunday. The first week of an ISO year is the first (Gregorian) calendar week of a year containing a Thursday. This is called week number 1, and the ISO year of that Thursday is the same as its Gregorian year.

Parameters:

array – Input numpy datetime64 array.

Returns:

A tuple of three numpy arrays (ISO years, ISO weeks, ISO weekdays).