semantique.processor.utils.convert_datetime64

semantique.processor.utils.convert_datetime64#

semantique.processor.utils.convert_datetime64(obj, tz_from, tz_to, **kwargs)[source]#

Convert a numpy datetime object to a different timezone.

Numpy datetime objects do not have native support for timezones anymore. Therefore pandas is used to convert between different timezones.

Parameters:
  • obj (numpy.datetime64) – Object to be converted.

  • tz_from – Timezone of the object to be converted. Can be given as str referring to the name of a timezone in the tz database, or as instance of any class inheriting from datetime.tzinfo.

  • tz_to – Timezone the object should be converted to. Can be given as str referring to the name of a timezone in the tz database, or as instance of any class inheriting from datetime.tzinfo.

  • **kwargs – Additional keyword arguments passed on to pandas.Timestamp.tz_convert().

Returns:

numpy.datetime64