Skip to main content

Module to encode and decode timestamps to/from TimeHashes

Project description

About

timehash is an algorithm (with multiple reference implementations) for calculating variable precision sliding windows of time. When performing aggregations and correlations on large-scale data sets, the ability to convert precise time values into ‘malleable intervals’ allows for many novel analytics.

Using sliding windows of time is a common practice in data analysis but prior to the timehash algorithm it was more of an art than a science.

timehash-shaded-partial.png

Features

  • convert epoch miliseconds into an interval of time, depicted by an ASCII character ‘hash’ (a ‘timehash’)

  • timehash values are well suited to referencing time intervals in key-value stores (e.g. Hbase, Acculumo, Redis)

  • The creation of a compound key of space and time (e.g. geohash_timehash) is a powerful primitive for understanding geotemporal patterns

Implementations

Usage

Example of calculating a timehash value in python:

import timehash
import time

rightnow = time.time()
rightnow60 = rightnow + 60.0

rightnow_hash = timehash.encode(rightnow, precision=10)
rightnow60_hash = timehash.encode(rightnow60, precision=10)

print 'timehash of right now: %s' % rightnow_hash
print 'timehash of now +60s: %s'% rightnow60_hash

% timehash of right now: ae0f0ba1fc
% timehash of now +60s: ae0f0baa1c

License

Modified BSD License

Contact

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

timehash-1.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timehash-1.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file timehash-1.2.tar.gz.

File metadata

  • Download URL: timehash-1.2.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for timehash-1.2.tar.gz
Algorithm Hash digest
SHA256 a7ddee20656861df1f3bcf8c3347c9d6894699e1128708f8521c543ba51afff7
MD5 d8d541441dbb16b5813b520965993a2e
BLAKE2b-256 8b1c393d4a2ccbadcee01f3d4abefe3671d779f0b901c0f7769e24d854faae9f

See more details on using hashes here.

File details

Details for the file timehash-1.2-py3-none-any.whl.

File metadata

  • Download URL: timehash-1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for timehash-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 78040c16e3adbe74bdc81cefb3bffa0521ee8ed046a3ffbf76f85b1b9203598e
MD5 2bcef09d24466246db43ca981f75bf7b
BLAKE2b-256 c1f7bb2d23f8de999b5ae4e55028e53fb777661ce7539ed559fd82886ffba5e8

See more details on using hashes here.

Supported by

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