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)
Metadata
Release files for th2analytics 0.0.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| th2analytics-0.0.15.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| th2analytics-0.0.15-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / th2analytics-0.0.15.tar.gz
| Download URL | th2analytics-0.0.15.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb0fba4f1305726cc24ee68845d116d084e76e519682e8683be8954ba942a961
|
|
BLAKE2b-256 checksum How to use checksums |
f979ec0fc01af006d5321759f2f4ff8676482ddaf2e10dee080e5eb50add5254
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.9
|
Release files / th2analytics-0.0.15-py3-none-any.whl
| Download URL | th2analytics-0.0.15-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13a429a0a0d7d179dd45d98beb6e990956539b9ea99a22ee64981d6602bf4453
|
|
BLAKE2b-256 checksum How to use checksums |
0ecc040187e891ed67a01a8b9337194b89ebc29a69a4b3b6c0d08c7496c7a2fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.9
|