pytsviz.utils module

The utils module contains utilities not strictly related to visualization which we often use (eg harmonics computation).

pytsviz.utils.harmonics(dates, period, n, epoch=datetime.datetime(1900, 1, 1, 0, 0))

Computes harmonics for the given dates. Each harmonic is made of a couple of sinusoidal and cosinusoidal waves with frequency i/period, i = 1…n. The argument of the functions is the number of hours from the starting epoch.

Parameters
  • dates (DataFrame) – A pandas series of dates.

  • period (int) – The base period of the harmonics.

  • n (int) – The number of harmonics to include.

  • epoch (datetime) – The epoch used to compute the argument of the sin.

Return type

DataFrame

Returns

A Pandas DataFrame with dates as index and harmonics as columns.