Package: cartwright
CartwrightCartwright 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 likecountry,day,latitude, and many other location and time types. Check out Cartwright'ssupported categoriesfor 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 ourdocs.InstallationYou can install Cartwright from PyPi withpip install cartwright.Using CartwrightImagine we have the following weather dataset:x_valuey_valuerecorded_atrainfall7.942658107.24032207/14/1992.27.943745137.24063307/15/1992.17.943725139.24066407/16/1992.3To the human observer, it's pretty obvious thatx_valueis the longitude column,y_valuethe latitude,recorded_atthe date, andrainfallthe actual weather measurement. However, if we're trying to automatically ingest this data into a weather model, we would benefit from knowing thiswithout 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 DetectionIn 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.1Cartwright 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 detecttemporal resolutionandspatial resolution.