Skip to main content

No project description provided

Project description

timevec

Functions to create time vectors

Description

Time has a periodic nature due to the rotation of the earth and the position of the sun. This affects human behavior in various ways.

  • Seasonality ... periodicity in a year (seasonal distinction)
  • Daily periodicity ... periodicity in a day (distinction between day and night)
  • Day of the week ... periodicity in a week (distinction between weekdays and holidays)

When dealing with these, it is desirable to vectorize with periodicity in mind. That is, at 23:59 on a given day, it is desirable that the value is close to 00:00 on the next day. To achieve this, the time is represented as a combination of cos and sin. This is called a time vector.

Installation

pip install timevec

Usage

import timevec.numpy as tv
import datetime
dt = datetime.datetime(2020, 1, 1, 0, 0, 0)
vec = tv.year_vec(dt)
# array([1., 0.])

Functions

  • timevec.numpy provides functions that return numpy.ndarray.
  • timevec.builtin_math provides functions that return tuple of float.

year_vec

year_vec(dt: datetime.datetime)

Create a time vector for a year. This is a vector that has periodicity like seasonality. (Summer, Autumn, Winter, Spring)

month_vec

month_vec(dt: datetime.datetime)

Create a time vector for a month. This is a vector that has periodicity in a month. You can express periodicity such as the beginning of the month, the end of the month, and the salary day.

week_vec

week_vec(dt: datetime.datetime)

Create a time vector for a week. This is a vector that has periodicity in a week. You can express periodicity such as weekdays and holidays.

day_vec

day_vec(dt: datetime.datetime)

Create a time vector for a day. This is a vector that has periodicity in a day. You can express periodicity such as morning, noon, and night.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timevec-0.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

timevec-0.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file timevec-0.0.0.tar.gz.

File metadata

  • Download URL: timevec-0.0.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for timevec-0.0.0.tar.gz
Algorithm Hash digest
SHA256 081a449591fdf2e0683c05bcef3d4ce79e2bf18a07bc7556ee7f1be408ba2e89
MD5 3bf2bccb4604a5bfed513216e14f179b
BLAKE2b-256 236a8915e4d6a01dbb93b7816aeb5162c532f93b364fa56b7d04fba75c357baa

See more details on using hashes here.

File details

Details for the file timevec-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: timevec-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for timevec-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d6db4e51726bc29565434cde4123e68c317b41461f94fdea434620ce48ecca3
MD5 8580a8e2ca573d6f2c532ff63ef36db8
BLAKE2b-256 2b17e80ad77e62d20df572f279d50b96a09299b09314f5ba019c2c4eb1e666cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page