Skip to main content

Command line script and Python library to manipulate time series.

Project description

Tests Test Coverage Latest release BSD-3 clause license tstoolbox downloads PyPI - Python Version

tstoolbox - Quick Guide

The tstoolbox is a Python script to manipulate time-series on the command line or by function calls within Python. Uses pandas (http://pandas.pydata.org/) or numpy (http://numpy.scipy.org) for any heavy lifting.

Installation

Should be as easy as running pip install tstoolbox or easy_install tstoolbox at any command line. Not sure on Windows whether this will bring in pandas, but as mentioned above, if you start with scientific Python distribution then you shouldn’t have a problem.

Usage - Command Line

Just run ‘tstoolbox –help’ to get a list of subcommands:

usage: tstoolbox [-h]
                 {accumulate, add_trend, aggregate, calculate_fdc,
                 calculate_kde, clip, convert, convert_index,
                 convert_index_to_julian, converttz, lag, correlation,
                 createts, date_offset, date_slice, describe, dtw,
                 equation, ewm_window, expanding_window, fill, filter, fit,
                 read, gof, normalization, pca, pct_change, peak_detection,
                 pick, plot, rank, regression, remove_trend, replace,
                 rolling_window, stack, stdtozrxp, tstopickle, unstack,
                 about} ...

positional arguments:
  {accumulate, add_trend, aggregate, calculate_fdc, calculate_kde, clip,
  convert, convert_index, convert_index_to_julian, converttz, lag,
  correlation, createts, date_offset, date_slice, describe, dtw, equation,
  ewm_window, expanding_window, fill, filter, fit, read, gof,
  normalization, pca, pct_change, peak_detection, pick, plot, rank,
  regression, remove_trend, replace, rolling_window, stack, stdtozrxp,
  tstopickle, unstack, about}

accumulate
    Calculate accumulating statistics.
add_trend
    Add a trend.
aggregate
    Take a time series and aggregate to specified frequency.
calculate_fdc
    Return the frequency distribution curve.
calculate_kde
    Return the kernel density estimation (KDE) curve.
clip
    Return a time-series with values limited to [a_min, a_max].
convert
    Convert values of a time series by applying a factor and offset.
convert_index
    Convert datetime to/from Julian dates from different epochs.
convert_index_to_julian
    DEPRECATED: Use convert_index instead.
converttz
    Convert the time zone of the index.
lag
    Create a series of lagged time-series.
correlation
    Develop a correlation between time-series and potentially lags.
createts
    Create empty time series, optionally fill with a value.
date_offset
    Apply a date offset to a time-series index.
date_slice
    Print out data to the screen between start_date and end_date.
describe
    Print out statistics for the time-series.
dtw
    Dynamic Time Warping.
equation
    Apply <equation_str> cto the time series data.
ewm_window
    Calculate exponential weighted functions.
expanding_window
    Calculate an expanding window statistic.
fill
    Fill missing values (NaN) with different methods.
filter
    Apply different filters to the time-series.
fit
    Fit model to data.
read
    Combines time-series from a list of pickle or csv files.
gof
    Will calculate goodness of fit statistics between two time-series.
normalization
    Return the normalization of the time series.
pca
    Return the principal components analysis of the time series.
pct_change
    Return the percent change between times.
peak_detection
    Peak and valley detection.
pick
    DEPRECATED: Will pick a column or list of columns from input
plot
    Plot data.
rank
    Compute numerical data ranks (1 through n) along axis.
regression
    Regression of one or more time-series or indices to a time-series.
remove_trend
    Remove a 'trend'.
replace
    Return a time-series replacing values with others.
rolling_window
    Calculate a rolling window statistic.
stack
    Return the stack of the input table.
stdtozrxp
    Print out data to the screen in a WISKI ZRXP format.
tstopickle
    Pickle the data into a Python pickled file.
unstack
    Return the unstack of the input table.
about
    Display version number and system information.

optional arguments:
  -h, --help            show this help message and exit

The default for all of the subcommands is to accept data from stdin (typically a pipe). If a subcommand accepts an input file for an argument, you can use “–input_ts=input_file_name.csv”, or to explicitly specify from stdin (the default) “–input_ts=’-‘”.

For the subcommands that output data it is printed to the screen and you can then redirect to a file.

Usage - API

You can use all of the command line subcommands as functions. The function signature is identical to the command line subcommands. The return is always a PANDAS DataFrame. Input can be a CSV or TAB separated file, or a PANDAS DataFrame and is supplied to the function via the ‘input_ts’ keyword.

Simply import tstoolbox:

import tstoolbox

# Then you could call the functions
ntsd = tstoolbox.fill(method='linear', input_ts='tests/test_fill_01.csv')

# Once you have a PANDAS DataFrame you can use that as input to other
# tstoolbox functions.
ntsd = tstoolbox.aggregate(statistic='mean', groupby='D', input_ts=ntsd)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tstoolbox-108.2.1.tar.gz (6.2 MB view details)

Uploaded Source

Built Distribution

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

tstoolbox-108.2.1-py3-none-any.whl (172.9 kB view details)

Uploaded Python 3

File details

Details for the file tstoolbox-108.2.1.tar.gz.

File metadata

  • Download URL: tstoolbox-108.2.1.tar.gz
  • Upload date:
  • Size: 6.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tstoolbox-108.2.1.tar.gz
Algorithm Hash digest
SHA256 80c963184033b280f9d01be0ee54f8f1174ba55805246cf018fc50a181d3b863
MD5 43798256f32110a907b3682cf0f6c68f
BLAKE2b-256 58c72c08a87b3b1d6c1e337585f2fe8879a5841d7a7135dcc500d84a0a7e8b2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tstoolbox-108.2.1.tar.gz:

Publisher: pypi-package.yml on timcera/tstoolbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tstoolbox-108.2.1-py3-none-any.whl.

File metadata

  • Download URL: tstoolbox-108.2.1-py3-none-any.whl
  • Upload date:
  • Size: 172.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tstoolbox-108.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 97cf0ba259a8a8d3167a459e3e755765cd43e013fd71b0b8d6a3b4854613c957
MD5 d87e29dba10f9f40f5b078b901266c13
BLAKE2b-256 2a7d88bd3b6e72babbe7c21e23881e01be9d87491215438b73120ff79ffae7d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for tstoolbox-108.2.1-py3-none-any.whl:

Publisher: pypi-package.yml on timcera/tstoolbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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