JSON-TimeSeries

raw JSON →
0.1.7 verified Fri May 01 auth: no python

Python library for handling JSON-TimeSeries (JTS) specification data. Version 0.1.7 supports creating, manipulating, and validating time series data in JTS format. Active development with minor fixes.

pip install json-timeseries
error ModuleNotFoundError: No module named 'json_timeseries'
cause Misspelled import or not installed.
fix
Install: pip install json-timeseries. Import: from json_timeseries import TimeSeries
error AttributeError: 'TimeSeries' object has no attribute 'to_jts'
cause Using an older version (<0.1.5) where method name might differ.
fix
Upgrade to latest version: pip install --upgrade json-timeseries
gotcha Timestamp keys must be ISO 8601 strings (e.g., '2024-01-01T00:00:00Z'). Using other formats may cause validation errors.
fix Always use ISO 8601 format with 'T' and 'Z'.
gotcha When a value is integer 0, it may be omitted in the JTS output if using v0.1.6 or earlier. Fixed in v0.1.7.
fix Upgrade to v0.1.7.

Create a basic time series and output JTS format.

from json_timeseries import TimeSeries

# Create a time series with two data points
ts = TimeSeries()
ts['2024-01-01T00:00:00Z'] = 10.5
ts['2024-01-02T00:00:00Z'] = 20.3

# Convert to JTS dictionary
print(ts.to_jts())