Name | rfmanalysis JSON |
Version |
0.2.0
JSON |
| download |
home_page | https://github.com/emmayann/rfmanalysis |
Summary | This repository contains a Python implementation of RFM (Recency, Frequency, Monetary) analysis, a customer segmentation technique used in marketing and customer relationship management. The RFM analysis helps identify customer segments based on their purchasing behavior, allowing businesses to tailor their marketing strategies and customer retention efforts. |
upload_time | 2023-05-17 00:13:13 |
maintainer | |
docs_url | None |
author | Emma Hovhannisyan |
requires_python | >=3.6 |
license | MIT license |
keywords |
rfmanalysis
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
Here's the README.md in reStructuredText format:
.. image:: https://img.shields.io/pypi/v/rfmanalysis.svg
:target: https://pypi.python.org/pypi/rfmanalysis
:alt: Latest PyPI version
RFM Analysis
============
This repository contains a Python implementation of RFM (Recency, Frequency, Monetary) analysis, a customer segmentation technique used in marketing and customer relationship management. The RFM analysis helps identify customer segments based on their purchasing behavior, allowing businesses to tailor their marketing strategies and customer retention efforts.
RFMAnalysis
-----------
The `RFMAnalysis` class provides methods to perform RFM analysis on customer transaction data. Here is an overview of the class and its methods:
### Class Initialization
.. code-block:: python
RFMAnalysis(data, id_col, date_col, revenue_col)
- `data`: Pandas DataFrame containing customer transaction data.
- `id_col`: Column name representing the unique customer identifier.
- `date_col`: Column name representing the transaction date.
- `revenue_col`: Column name representing the transaction revenue.
### Methods
- `create_rfm_columns()`: Creates the RFM columns (Recency, Frequency, Monetary) based on the transaction data.
- `scale_rfm_columns()`: Scales the RFM columns into quartiles (4 segments) for scoring.
- `rfm_scores()`: Calculates the RFM scores and segments for each customer.
- `top_customers()`: Sorts the customers by RFM segments in descending order.
- `give_names_to_segments()`: Assigns segment names to each RFM segment based on the RFM scores.
- `segments_distribution()`: Returns a DataFrame with the mean RFM values and segment counts.
RFMVisualizer
-------------
The `RFMVisualizer` class provides visualizations for RFM analysis. Here is an overview of the class and its methods:
### Static Methods
- `plot_rfm(rfm_data)`: Plots the distribution of RFM scores.
- `visualize_segments(rfm_data)`: Displays a treemap visualization of customer segments.
- `segment_distribution_barplot(rfm_data)`: Displays a bar chart of segment counts.
- `segment_boxplot(rfm_data)`: Displays boxplots of RFM scores for each segment.
- `segment_comparison(rfm_data)`: Displays bar charts comparing average RFM scores for each segment.
Usage
-----
To use the `RFMAnalysis` and `RFMVisualizer` classes, follow these steps:
1. Load the customer transaction data into a Pandas DataFrame.
2. Instantiate the `RFMAnalysis` class, providing the necessary parameters.
3. Call the methods of the `RFMAnalysis` class to perform RFM analysis and generate segment information.
4. Instantiate the `RFMVisualizer` class.
5. Call the visualization methods of the `RFMVisualizer` class, passing the RFM data generated by the `RFMAnalysis` class.
Here's an example of how to use these classes:
.. code-block:: python
import pandas as pd
from RFMAnalysis import RFMAnalysis
from RFMVisualizer import RFMVisualizer
# Load the customer transaction data
data = pd.read_csv('customer_transactions.csv')
# Perform RFM analysis
analysis = RFMAnalysis(data, 'customer_id', 'transaction_date', 'revenue')
analysis.create_rfm_columns()
analysis.scale_rfm_columns()
analysis.rfm_scores()
analysis.top_customers()
analysis.give_names_to_segments()
# Visualize RFM analysis
visualizer = RFMVisualizer()
visualizer.plot_rfm(
analysis.rfm_data)
visualizer.visualize_segments(analysis.rfm_data)
visualizer.segment_distribution_barplot(analysis.rfm_data)
visualizer.segment_boxplot(analysis.rfm_data)
visualizer.segment_comparison(analysis.rfm_data)
Requirements
------------
The implementation requires the following libraries to be installed:
- pandas
- seaborn
- matplotlib
- squarify
You can install them using `pip`:
.. code-block:: bash
pip install pandas seaborn matplotlib squarify
License
-------
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
=======
History
=======
0.1.0 (2023-05-16)
------------------
* First release on PyPI.
Raw data
{
"_id": null,
"home_page": "https://github.com/emmayann/rfmanalysis",
"name": "rfmanalysis",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "rfmanalysis",
"author": "Emma Hovhannisyan",
"author_email": "emmahovhannisyan02@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e3/b3/7a5bfc29c352122b292132030e0b19fe8f852f732a8cb41c75eacc0cc878/rfmanalysis-0.2.0.tar.gz",
"platform": null,
"description": "Here's the README.md in reStructuredText format:\r\n\r\n.. image:: https://img.shields.io/pypi/v/rfmanalysis.svg\r\n :target: https://pypi.python.org/pypi/rfmanalysis\r\n :alt: Latest PyPI version\r\n\r\nRFM Analysis\r\n============\r\n\r\nThis repository contains a Python implementation of RFM (Recency, Frequency, Monetary) analysis, a customer segmentation technique used in marketing and customer relationship management. The RFM analysis helps identify customer segments based on their purchasing behavior, allowing businesses to tailor their marketing strategies and customer retention efforts.\r\n\r\nRFMAnalysis\r\n-----------\r\n\r\nThe `RFMAnalysis` class provides methods to perform RFM analysis on customer transaction data. Here is an overview of the class and its methods:\r\n\r\n### Class Initialization\r\n\r\n.. code-block:: python\r\n\r\n RFMAnalysis(data, id_col, date_col, revenue_col)\r\n\r\n- `data`: Pandas DataFrame containing customer transaction data.\r\n- `id_col`: Column name representing the unique customer identifier.\r\n- `date_col`: Column name representing the transaction date.\r\n- `revenue_col`: Column name representing the transaction revenue.\r\n\r\n### Methods\r\n\r\n- `create_rfm_columns()`: Creates the RFM columns (Recency, Frequency, Monetary) based on the transaction data.\r\n- `scale_rfm_columns()`: Scales the RFM columns into quartiles (4 segments) for scoring.\r\n- `rfm_scores()`: Calculates the RFM scores and segments for each customer.\r\n- `top_customers()`: Sorts the customers by RFM segments in descending order.\r\n- `give_names_to_segments()`: Assigns segment names to each RFM segment based on the RFM scores.\r\n- `segments_distribution()`: Returns a DataFrame with the mean RFM values and segment counts.\r\n\r\nRFMVisualizer\r\n-------------\r\n\r\nThe `RFMVisualizer` class provides visualizations for RFM analysis. Here is an overview of the class and its methods:\r\n\r\n### Static Methods\r\n\r\n- `plot_rfm(rfm_data)`: Plots the distribution of RFM scores.\r\n- `visualize_segments(rfm_data)`: Displays a treemap visualization of customer segments.\r\n- `segment_distribution_barplot(rfm_data)`: Displays a bar chart of segment counts.\r\n- `segment_boxplot(rfm_data)`: Displays boxplots of RFM scores for each segment.\r\n- `segment_comparison(rfm_data)`: Displays bar charts comparing average RFM scores for each segment.\r\n\r\nUsage\r\n-----\r\n\r\nTo use the `RFMAnalysis` and `RFMVisualizer` classes, follow these steps:\r\n\r\n1. Load the customer transaction data into a Pandas DataFrame.\r\n2. Instantiate the `RFMAnalysis` class, providing the necessary parameters.\r\n3. Call the methods of the `RFMAnalysis` class to perform RFM analysis and generate segment information.\r\n4. Instantiate the `RFMVisualizer` class.\r\n5. Call the visualization methods of the `RFMVisualizer` class, passing the RFM data generated by the `RFMAnalysis` class.\r\n\r\nHere's an example of how to use these classes:\r\n\r\n.. code-block:: python\r\n\r\n import pandas as pd\r\n from RFMAnalysis import RFMAnalysis\r\n from RFMVisualizer import RFMVisualizer\r\n\r\n # Load the customer transaction data\r\n data = pd.read_csv('customer_transactions.csv')\r\n\r\n # Perform RFM analysis\r\n analysis = RFMAnalysis(data, 'customer_id', 'transaction_date', 'revenue')\r\n analysis.create_rfm_columns()\r\n analysis.scale_rfm_columns()\r\n analysis.rfm_scores()\r\n analysis.top_customers()\r\n analysis.give_names_to_segments()\r\n\r\n # Visualize RFM analysis\r\n visualizer = RFMVisualizer()\r\n visualizer.plot_rfm(\r\n\r\nanalysis.rfm_data)\r\n visualizer.visualize_segments(analysis.rfm_data)\r\n visualizer.segment_distribution_barplot(analysis.rfm_data)\r\n visualizer.segment_boxplot(analysis.rfm_data)\r\n visualizer.segment_comparison(analysis.rfm_data)\r\n\r\nRequirements\r\n------------\r\n\r\nThe implementation requires the following libraries to be installed:\r\n\r\n- pandas\r\n- seaborn\r\n- matplotlib\r\n- squarify\r\n\r\nYou can install them using `pip`:\r\n\r\n.. code-block:: bash\r\n\r\n pip install pandas seaborn matplotlib squarify\r\n\r\nLicense\r\n-------\r\n\r\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\r\n\r\n=======\r\nHistory\r\n=======\r\n\r\n0.1.0 (2023-05-16)\r\n------------------\r\n\r\n* First release on PyPI.\r\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "This repository contains a Python implementation of RFM (Recency, Frequency, Monetary) analysis, a customer segmentation technique used in marketing and customer relationship management. The RFM analysis helps identify customer segments based on their purchasing behavior, allowing businesses to tailor their marketing strategies and customer retention efforts.",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/emmayann/rfmanalysis"
},
"split_keywords": [
"rfmanalysis"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8da0472e81feb17b0db2a020c19d36f13e29856e28d8115ba2c3d761eaaac755",
"md5": "989fb14d66541ff11324c9882e42dd88",
"sha256": "812c58fa5006b5e4645a084ef9fc250e166645c49708a6ee732952b3c51d080d"
},
"downloads": -1,
"filename": "rfmanalysis-0.2.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "989fb14d66541ff11324c9882e42dd88",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 6672,
"upload_time": "2023-05-17T00:13:04",
"upload_time_iso_8601": "2023-05-17T00:13:04.572104Z",
"url": "https://files.pythonhosted.org/packages/8d/a0/472e81feb17b0db2a020c19d36f13e29856e28d8115ba2c3d761eaaac755/rfmanalysis-0.2.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e3b37a5bfc29c352122b292132030e0b19fe8f852f732a8cb41c75eacc0cc878",
"md5": "0cbc1dc3f3b17357038c277dba176c1f",
"sha256": "13bc017f782be1716d8d512aacfb705e936c26fcb3af1e432441b1bf1d93e752"
},
"downloads": -1,
"filename": "rfmanalysis-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "0cbc1dc3f3b17357038c277dba176c1f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 13422,
"upload_time": "2023-05-17T00:13:13",
"upload_time_iso_8601": "2023-05-17T00:13:13.240426Z",
"url": "https://files.pythonhosted.org/packages/e3/b3/7a5bfc29c352122b292132030e0b19fe8f852f732a8cb41c75eacc0cc878/rfmanalysis-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-17 00:13:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "emmayann",
"github_project": "rfmanalysis",
"github_not_found": true,
"lcname": "rfmanalysis"
}