A Python package for interacting with the thaink2 analytics APIs
Project description
th2analytics
th2analytics is a Python library that provides a simple and efficient wrapper for interacting with the thaink2 analytics APIs. It enables users to generate future forecasts rapidly while adapting to various types of data.
Features
- Generate forecasts quickly using an intuitive interface.
- Supports multiple forecasting models like ARIMA, XGBOOST, Random, and others.
- Customizable parameters for forecast horizon, grouping, and target variables.
- Lightweight and easy to integrate into existing workflows.
Installation
Install the package using pip:
pip install th2analytics
A bearer token is needed in order to perform the API request, use the following url to generate a valid token thaink2 token generator
from th2analytics.forecasting import ForecastingAPI
import numpy as np
import pandas as pd
api_token = "************" # get your token here: https://clever.thaink2.fr/app_direct/th2token/
# Initialize the API wrapper
api = ForecastingAPI(
base_url = "https://clever.thaink2.fr/app_direct/th2apis/private/",
api_token = api_token
)
np.random.seed(42)
dates = pd.date_range(start='2022-01-01', periods=100, freq='D')
values = np.random.randn(100).cumsum()
# Create a DataFrame from the generated data
input_data = pd.DataFrame({'date': dates, 'value': values})
# Generate the forecast
forecast = api.th2forecast_api(
actuals = input_data,
fcast_horizon = 30,
group_target = None,
target_var = "value",
date_var = "date",
models_list = ["xgboost"]
)
# Print the forecast
forecast_df = pd.json_normalize(forecast)
print(forecast_df)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file th2analytics-0.0.15.tar.gz.
File metadata
- Download URL: th2analytics-0.0.15.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb0fba4f1305726cc24ee68845d116d084e76e519682e8683be8954ba942a961
|
|
| MD5 |
675972dd490e90867c341d617675d8bc
|
|
| BLAKE2b-256 |
f979ec0fc01af006d5321759f2f4ff8676482ddaf2e10dee080e5eb50add5254
|
File details
Details for the file th2analytics-0.0.15-py3-none-any.whl.
File metadata
- Download URL: th2analytics-0.0.15-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13a429a0a0d7d179dd45d98beb6e990956539b9ea99a22ee64981d6602bf4453
|
|
| MD5 |
77d830f4b4ddb34b71bd7dbdb9820a36
|
|
| BLAKE2b-256 |
0ecc040187e891ed67a01a8b9337194b89ebc29a69a4b3b6c0d08c7496c7a2fb
|