TimeZoneChange(mode, zone=None)
Source¶
A change of the time zone of a datetime column, used by TableConversion.
Added in version 0.1.0
Parameters:
-
mode(TimeZoneMode)Whether a zone is given to datetimes without one, datetimes are moved to another zone, or their zone is removed.
-
zone(TimeZone | None, default:None)The new zone, needed by
TimeZoneMode.ATTRIBUTEandSHIFT.REMOVErefuses it, so it is the only mode used when omitted.
Raises:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names.
-
InvalidTimeZoneChangeError
Examples:
from datetime import datetime
import numdaplot as ndp
times = ndp.Table.from_arrays({"time": ndp.Array.from_list([datetime(2026, 7, 1, 10, 30)])})
paris = ndp.TimeZoneChange(mode=ndp.TimeZoneMode.ATTRIBUTE, zone=ndp.TimeZone("Europe/Paris"))
times.convert(ndp.TableConversion(columns=["time"], dtype=ndp.Type.DATETIME, timezone=paris))
# time
# DATETIME Europe/Paris
# 0 2026-07-01 10:30:00+02:00