Skip to main content

Google Location History utilities

Project description

spots Build Status

Google Location History utilities

Installation

$ pip install spots

Usage

Load location history json as pandas DataFrame

from spots import LocationHistory
locdf = LocationHistory.from_json("your-location-history-file.json")
locdf.head()

#   accuracy   activity                                         lat        lon               timestamp
#           confidence               timestamp     type                                              
#0       24        100 2014-01-05 09:47:07.808  UNKNOWN -23.340981 -46.579202 2014-01-05 09:47:07.808
#1       24        100 2014-01-05 09:47:54.558  TILTING -23.123471 -46.631244 2014-01-05 09:48:21.891
#2       24        100 2014-01-05 09:49:21.461  UNKNOWN -23.456211 -46.640234 2014-01-05 09:49:21.461
#3       24        100 2014-01-05 09:50:21.470  UNKNOWN -23.464231 -46.604355 2014-01-05 09:50:21.470
#4       25        100 2014-01-05 09:51:21.623  UNKNOWN -23.490080 -46.709021 2014-01-05 09:51:21.623

Calculate stay points for your trajectory

The StayPointDetection class implements the same interface used by sklearn clustering algorithms.

from spots import StayPointDetection
import numpy as np

spd = StayPointDetection(distance=0.05, time=np.timedelta(15, 'm'))
staypoints = spd.fit_predict(X=locdf[['lat', 'lon']].values, timestamp=locdf.timestamp)
locdf.loc[:, "staypoint_id"] = staypoints

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

spots-1.0.4.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

spots-1.0.4-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file spots-1.0.4.tar.gz.

File metadata

  • Download URL: spots-1.0.4.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/38.5.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for spots-1.0.4.tar.gz
Algorithm Hash digest
SHA256 098fda99acd857272d5d915f28712a7c9cc41db00dd317cd94561627486f9bcf
MD5 e8afda286c4086db2904a0e672218fcf
BLAKE2b-256 43f56ac290ae1b20ea25dffa2caf9e3965621e2d465231bb9287ea3011f5bc5c

See more details on using hashes here.

File details

Details for the file spots-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: spots-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/38.5.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for spots-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9759b6a0ad8ff27c892f17899851557e5bb8ac1d6fff60b2b499dc3f172661ef
MD5 295c275e5d951786c6b2aee8fd2b77ca
BLAKE2b-256 98848f71a1f8ff297e8c1c6e099eb2974721ac53895543f9c003f6620901d5be

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