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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

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