Skip to main content

A recurrent neural network paired with heuristic methods that automatically infer geospatial, temporal and feature columns

Project description

Cartwright

Tests

Cartwright is a data profiler that identifies and categorizes spatial and temporal features. Cartwright uses deep learning, natural language processing, and a variety of heuristics to determine whether a column in a dataset contains spatial or temporal information and, if so, what is specifically contained.

Cartwright was built to automate complex data pipelines for heterogenous climate and geopolitical data that are generally oriented around geospatial and temporal features (think maps and time series). The challenge that Cartwright solves is automatically detecting those features so they can be parsed and normalized. This problem turns out to be quite tricky, but Cartwright makes it simple.

Cartwright can easily detect things like country, day, latitude, and many other location and time types. Check out Cartwright's supported categories for a complete listing!

Cartwright is easy to install and works with pretty much any tabular data. It's easy to add new categories too! Learn more about the methodology behind Cartwright, its API, and how to contribute in our docs.

Installation

You can install Cartwright from PyPi with pip install cartwright.

Using Cartwright

Imagine we have the following weather dataset:

x_value y_value recorded_at rainfall
7.942658 107.240322 07/14/1992 .2
7.943745 137.240633 07/15/1992 .1
7.943725 139.240664 07/16/1992 .3

To the human observer, it's pretty obvious that x_value is the longitude column, y_value the latitude, recorded_at the date, and rainfall the actual weather measurement. However, if we're trying to automatically ingest this data into a weather model, we would benefit from knowing this without human observation. Enter Cartwright:

from pprint import pprint
from cartwright import categorize

cartwright = categorize.CartwrightClassify()
categories = cartwright.categorize(path="path/to/data.csv")

pprint(categories, sort_dicts=False)

We've now categoriezed each column in this dataset and have automatically determined which column represents latitude, longitude and date. We've also learned the time format (%m/%d/%Y) of the date feature.

{'x_value': {'category': <Category.geo: 'geo'>,
             'subcategory': <Subcategory.longitude: 'longitude'>,
             'format': None},
 'y_value': {'category': <Category.geo: 'geo'>,
             'subcategory': <Subcategory.latitude: 'latitude'>,
             'format': None},
 'recorded_at': {'category': <Category.time: 'time'>,
                'subcategory': <Subcategory.date: 'date'>,
                'format': '%m/%d/%Y'}}

With this information we can now convert the date values to a timestamp and plot a timeseries with other features.

Resolution Detection

In addition to its ability to categorize spatial and temporal features, Cartwright can determine their resolution. For example, given a dataset like:

date,temperature(C)
2019-01-01 00:00:00, 10.2
2019-01-01 02:00:00, 11.7
2019-01-01 04:00:00, 12.3
...
2019-12-31 22:00:00, 10.1

Cartwright can detect it's temporal resolution:

Resolution(
    uniformity=Uniformity.PERFECT,
    unit=TimeUnit.HOUR,
    resolution=2.0,
    error=0.0,
)

For gridded data, which is common in the scientific domain, Cartwright can also determine the spatial resolution (grid size). Check out the docs to learn more about using Cartwright to detect temporal resolution and spatial resolution.

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

cartwright-0.0.3.tar.gz (501.5 kB view details)

Uploaded Source

Built Distribution

cartwright-0.0.3-py3-none-any.whl (504.1 kB view details)

Uploaded Python 3

File details

Details for the file cartwright-0.0.3.tar.gz.

File metadata

  • Download URL: cartwright-0.0.3.tar.gz
  • Upload date:
  • Size: 501.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.15 Linux/5.15.0-52-generic

File hashes

Hashes for cartwright-0.0.3.tar.gz
Algorithm Hash digest
SHA256 9b020e28953ca128b8d1d04bb5dffc15a871a81f18272d1c967dbc501d01f085
MD5 d42a41f6c60063f1bc8f4b67322db2f9
BLAKE2b-256 dee95c5af9debef4dc0616916e6cb79f50770bd01f1ca631403e34cb42531541

See more details on using hashes here.

File details

Details for the file cartwright-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: cartwright-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 504.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.15 Linux/5.15.0-52-generic

File hashes

Hashes for cartwright-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4ec2402e42a7b282feef2d0075c5e110a9c30313e3b87ac22dd15b335f50dcc2
MD5 8711d68e00eabc6577fa76f8f7e69b8b
BLAKE2b-256 65f759fd492d879e7ef793f60fe44a13aba35cb27b86d411039cddc89f9b324d

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