Skip to main content

camplet

A pure Python implementation of CAMPLET, a transparent, adaptive seasonal adjustment method that corrects for seasonality and outliers via arithmetic-progression updates, without model identification or optimisation.

Ported from the original VBA macro (D200603-CampletExcel-v4.2, basCBFherzien.bas) and validated against its own output (see tests/test_camplet.py). A Java port for JDemetra+ v3 lives at jdplus-camplet; this package has no dependency on it or on Java.

Installation

pip install camplet  # once published; for now: pip install -e .

Usage

import pandas as pd
from camplet import camplet

idx = pd.date_range("2000-01-01", periods=144, freq="MS")
x = pd.Series(range(144), index=idx, dtype=float)

res = camplet(x)
print(res.accuracy)
print(res.to_frame().head())

camplet() is univariate: one series in, one result out. To adjust many series, loop over them yourself (e.g. df.groupby(...).apply(...)) - the same way you would with statsmodels.tsa decompositions.

The returned CampletResult.data has raw/sa/seasonal columns; .to_frame() (diagnostics included by default) adds the per-period adaptive-parameter trace that the original VBA tool wrote to its "Adj_" worksheets (ca, mu, pa, le, ti, expo_e, abs_pct_e, years, weight, growth).

Input requirements

CAMPLET reads observations by position: the k-th value is taken to be the period after the (k-1)-th. A skipped period therefore shifts every later observation into the wrong season while still producing plausible-looking output. To catch this, camplet():

  • raises ValueError if x contains NaN/None/inf (fill or trim the gaps first);
  • raises ValueError if the Series' DatetimeIndex/PeriodIndex (or dates) has duplicated, out-of-order or irregularly spaced timestamps, e.g. a missing month;
  • warns (UserWarning) if an explicit periodicity contradicts monthly or quarterly timestamps, e.g. periodicity=4 on monthly data.

A plain list or array without timestamps can't be checked, so making sure it has no gaps is up to you.

Metadata

Release files for camplet 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for camplet 1.0.0
File Size Uploaded Provenance Actions
camplet-1.0.0.tar.gz 24.0 kB Without provenance Details for camplet-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for camplet 1.0.0
File Interpreter ABI Platform Actions
camplet-1.0.0-py3-none-any.whl Python 3 none any Details for camplet-1.0.0-py3-none-any.whl

Total release size: 46.8 kB

Release files / camplet-1.0.0.tar.gz

Download URL camplet-1.0.0.tar.gz
Size 24.0 kB
Tags Source
SHA-256 checksum
How to use checksums
405f833b22d9eea0328e8b9ba42d011ff81f56027878242cd938794d59c0707e
BLAKE2b-256 checksum
How to use checksums
892e40e82b595a4ef7bf3f4474551d05332158d5de36d54918b4dbe220b0a33b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.13

Release files / camplet-1.0.0-py3-none-any.whl

Download URL camplet-1.0.0-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cb03c099a3115b493f61a6b2e097b69c2055b6aab07405517ca22bf7cf8d757
BLAKE2b-256 checksum
How to use checksums
26f168b819f42cf7afe1734be590e49c31f4f1f3ed828cbd6bffe56cefbfba73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.13

Security for camplet 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page