
Product
Announcing Precomputed Reachability Analysis in Socket
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
theforecastingcompany
Advanced tools
The python SDK provides a simple interface to make forecasts using the TFC API.
The REST API documentation can be found on https://api.retrocast.com/docs.
To get an API key, visit the Authentication docs. In the API Keys section you will find an option to Sign in or, if you already signed in, a box containing your API key.
# install from PyPI
pip install theforecastingcompany
# By default it will look for api_key in os.getenv("TFC_API_KEY"). Otherwise you can explicity set the api_key argument
client = TFCClient()
# Compute forecast for a single model
timesfm_df = client.forecast(
train_df,
model=TFCModels.TimesFM_2 # StrEnum defined in utils. You can also pass the model name as a string, eg timesfm-2
horizon=12,
freq="W",
)
# Global Model with static variables
tfc_global_df = client.forecast(
train_df,
model=TFCModels.TFCGlobal,
horizon=12,
freq="W",
static_variables=["unique_id","Group","Vendor","Category"],
add_holidays=True,
add_events=True,
country_isocode = "US"
)
If future_variables are available, make sure to pass also a future_df
when forecasting, and setting the future_variables
argument. All future variables must be present in the future_df
.
The cross_validate
function is basically the same, but takes a fcds
argument to define the FCDs to use for cross-validation. It also returns the target column in the output dataframe.
train_df
and future_df
should have id_col
(default "unique_id"), date_col
(default "ds"), and target_col
(default "target"). You can set the corresponding arguments if column names are different from default ones.
This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
We are keen for your feedback; please open an issue with questions, bugs, or suggestions.
If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.
You can determine the version that is being used at runtime with:
import theforecastingcompany
print(theforecastingcompany.__version__)
Python 3.11 or higher.
FAQs
The official Python library for The Forecasting Company API
We found that theforecastingcompany demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.