Skip to main content

clumpi [klˈʌmpάɪ]

PyPI DOI

sample data in pandas DataFrame

Overview

A simple python package to calculate Clumpiness for RMFC analysis by Zhang, Bradlow & Small (2015). Easy use with clumpi.get_RFC()

Requirements

  • Python
  • pandas
  • numpy
  • matplotlib

works well with Google Colab.

Installation

Simply use pip install for install this from PyPI:

pip install clumpi

or you can from Git repo:

pip install git+https://github.com/jniimi/clumpi.git

(perhaps, git repo version may be newer.)

Dataset

Use your discrete time-series event data with ID and time.

  • Create DataFrame that records only the point in time when the event occurred in the time series data.
  • The name of the variables can be anything.
user_id t
Ava 1
Ava 4
... ...
Jack 3
Jack 10
... ...

Check out our sample dataset for further details.

df = clumpi.load_sample_data()
display(df)

sample data in pandas DataFrame

Usage

Log to Clumpiness

Use the function clumpi.get_RFC() to calculate. Specify following arguments.

  • id: a column name indicating user

  • t: a column name indicating discrete time (e.g., a day in a month), t starts from 1 (Not 0).

  • N: a maximum number of events during the period (e.g., # of days in a month)

  • M (optional): a number of iterations for the simulation to calculate threshold (3000 for default)

  • alpha (optional): a significance level for the test of regularity (0.05 for default)

  • plot (optional): bool whether plot the frequency by users

    By specifying the argument plot=True, then the function displays the following scatter plot. scatter plot by user_id

Simply Calculate H0

Use the function clumpi.calc_threshold() to calculate upper alpha % point in M times simulation.

All you need to specify are N, M, and alpha (See clumpi.get_RFC).

Acknoledgement

The simulation in this package is based on Appendix B by Zhang et al. (2015).

Zhang, Y., Bradlow, E. T., & Small, D. S. (2015). Predicting customer value using clumpiness: From RFM to RFMC. Marketing Science, 34(2), 195-208. https://doi.org/10.1287/mksc.2014.0873

Author and Citation

jniimi (@JvckAndersen)

@misc{niimi2024clumpi,
  author = {Junichiro Niimi},
  title = {clumpi: A Python package for calculating Clumpiness in RFMC analysis},
  year = {2024},
  publisher = {Zenodo},
  doi = {10.5281/zenodo.15202295},
  url = {https://github.com/jniimi/clumpi}
}

Metadata

Release files for clumpi 1.0.1

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

Source distribution (sdist)

Source distribution for clumpi 1.0.1
File Size Uploaded Provenance Actions
clumpi-1.0.1.tar.gz 5.0 kB Without provenance Details for clumpi-1.0.1.tar.gz

Release files / clumpi-1.0.1.tar.gz

Download URL clumpi-1.0.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
faf7b7077886b8290ee846df5baf0e0b61c398c259fb3f6b88f5e77565ace63f
BLAKE2b-256 checksum
How to use checksums
7efe2e213b6cefd756f9c93d5d7e474dd6a51a2fc8dbff56838495229ab73a2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Security for clumpi 1.0.1

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.

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