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

customersegmentationrfm-0.0.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

customersegmentationrfm-0.0.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file customersegmentationrfm-0.0.1.tar.gz.

File metadata

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

File hashes

Hashes for customersegmentationrfm-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6bd84e4310c56b67ea8fc633d6e8cc291300669abb3da487be6499239a35dde4
MD5 81d264a17db1acea302c4f1da9851c2e
BLAKE2b-256 1b3a6bb44956d57da3a96b55431a8314d795359e4bf20e743121db2cdfc6f0d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for customersegmentationrfm-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 af26218402efd15c8c610b2518389142f9bb2271431f399851858278ae4b6686
MD5 a1ae59fc34d17f3393572cfe1b4a2441
BLAKE2b-256 7c5a96a8f841e7336287c5e032e6536cc599ba557abf6019dac622482835e767

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