Skip to main content

Customer Segmentation: RFM Anlaysis

Project description

Customer Segmentation: RFM

Customer segmentation and RFM analysis

Recency, frequency, and monetary value (RFM) analysis is a technique used in marketing to determine which customers are the most valuable. RFM is useful for estimating a company's revenue from both existing and potential customers by determining which customers are most likely to make repeat purchases of the company's items.

This package does the data processing for the inputted data, conducts RFM Analysis and provides ability to visualize the results and identify the most valueable customer segments.

Example Usage

I used Online Retail Store data to illustrate functionality of the package.
Here is the data I used for further analysis

Screen Shot 2022-12-16 at 21 35 35

The package helps to investigate the data, find anomalies and understand its' overall structure and feauture distributions.

rfm = CustomerSegmentation(df, customer_id='CustomerID', transaction_date='InvoiceDate', amount='Amount')
rfm.exploratory_analysis(df)
Screen Shot 2022-12-16 at 21 51 39 Screen Shot 2022-12-16 at 21 40 42 With the help of this function we can get descriptive statistics, and important information about the data, with which we are going to work.

The package enables to find the RFM scores, segment the customers based on their scores.

df_scores = rfm.produce_rfm_dateset(df)
df_scores.head()
Screen Shot 2022-12-16 at 21 42 02
df_scores = rfm.calculate_rfm_score(df_values)
rfm_table = rfm.find_segments(df_scores)
segment_table = rfm.find_segment_df(rfm.rfm_table)
segment_table.head()
Screen Shot 2022-12-16 at 21 44 51

We can also plot the distribution of segments, and visually identify the ones with highest number of customers

rfm.plot_segment_distribution()
Screen Shot 2022-12-16 at 21 46 10
rfm.find_customers('Champions')
Screen Shot 2022-12-16 at 21 47 20

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cs-rfm-0.0.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cs_rfm-0.0.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file cs-rfm-0.0.1.tar.gz.

File metadata

  • Download URL: cs-rfm-0.0.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for cs-rfm-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f5067a01a20f36d3ecf45957cfad4d27603840bf7e7907be3ad13ab325d4f56a
MD5 44d4fc0b8a691a8234499d8ec379dcc4
BLAKE2b-256 2a8867f7358ca426f74c8c1d1aca90bdff23f2140910a3d35a279a3472cff93d

See more details on using hashes here.

File details

Details for the file cs_rfm-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: cs_rfm-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for cs_rfm-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 330aa93a068a17dffe4f5803ada9fd5c2969d242327fa2b8b931611b9392d0e4
MD5 34fd10d1b3117fead662efda8ae36778
BLAKE2b-256 a4158b8a82522e574ec1c8c978ebd93b7010bbd80b0f2991cfce5bd2267af62b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page