{"id":13710309,"url":"https://github.com/sonwanesuresh95/rfm","last_synced_at":"2026-04-10T10:03:49.689Z","repository":{"id":57461792,"uuid":"458799470","full_name":"sonwanesuresh95/rfm","owner":"sonwanesuresh95","description":"Python Package for RFM Analysis and Customer Segmentation","archived":false,"fork":false,"pushed_at":"2022-03-02T16:40:59.000Z","size":3603,"stargazers_count":36,"open_issues_count":3,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-02T19:43:55.284Z","etag":null,"topics":["customer-segmentation","python","rfm-analysis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sonwanesuresh95.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-13T12:14:38.000Z","updated_at":"2025-12-13T01:05:03.000Z","dependencies_parsed_at":"2022-08-28T01:51:36.861Z","dependency_job_id":null,"html_url":"https://github.com/sonwanesuresh95/rfm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sonwanesuresh95/rfm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonwanesuresh95%2Frfm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonwanesuresh95%2Frfm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonwanesuresh95%2Frfm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonwanesuresh95%2Frfm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sonwanesuresh95","download_url":"https://codeload.github.com/sonwanesuresh95/rfm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonwanesuresh95%2Frfm/sbom","scorecard":{"id":838161,"data":{"date":"2025-08-11","repo":{"name":"github.com/sonwanesuresh95/rfm","commit":"f72d9fd672c6394ccef058698e2f6c9d87ebcea9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-23T19:44:26.289Z","repository_id":57461792,"created_at":"2025-08-23T19:44:26.289Z","updated_at":"2025-08-23T19:44:26.289Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31637749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["customer-segmentation","python","rfm-analysis"],"created_at":"2024-08-02T23:00:54.295Z","updated_at":"2026-04-10T10:03:49.668Z","avatar_url":"https://github.com/sonwanesuresh95.png","language":"Python","funding_links":[],"categories":["Personalisation / Segmentation"],"sub_categories":[],"readme":"\u003cbr\u003e\n\u003cbr\u003e\n\u003cdiv align=\"left\"\u003e\n\u003cimg style=\"width:400px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm-logos_black.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n[![PyPI Latest Release](https://img.shields.io/pypi/v/rfm.svg)](https://pypi.org/project/rfm/)\n![PyPI](https://badge.fury.io/py/rfm.svg)\n[![Package Status](https://img.shields.io/pypi/status/rfm.svg)](https://pypi.org/project/rfm/)\n[![License](https://img.shields.io/pypi/l/rfm.svg)](https://github.com/sonwanesuresh95/rfm/blob/main/LICENSE)\n![Downloads Per Month](https://img.shields.io/pypi/dm/rfm)\n\n# rfm\n\u003cb\u003erfm: Python Package for RFM Analysis and Customer Segmentation\u003c/b\u003e\n\n## Info\n\n**rfm** is a Python package that provides **recency, frequency, monetary analysis** results\nfor a certain transactional dataset within a snap. Its flexible structure and multiple automated\nfunctionalities provide easy and intuitive approach to RFM Analysis in an automated fashion.\nIt aims to be a ready-made python package with high-level and quick prototyping.\nOn practical hand, **real world data** is easily suited and adapted by the package.\nAdditionally, it can make colorful, intuitive graphs using a matplotlib backend without \nbreaking a sweat.\n\n## Installation\n### Dependencies\n\u003cul\u003e\n  \u003cli\u003ePython (\u003e=3.7)\u003c/li\u003e\n  \u003cli\u003ePandas (\u003e=1.2.4)\u003c/li\u003e\n  \u003cli\u003eNumPy (\u003e=1.20.1)\u003c/li\u003e\n  \u003cli\u003ematplotlib (\u003e=3.3.4)\u003c/li\u003e\n\u003c/ul\u003e\n\nTo install the current release (Ubuntu and Windows):\n\n```\n$ pip install rfm\n```\n\n## Usage\n\n```\n# predefine a transaction dataset as df\n\n\u003e\u003e\u003e from rfm import RFM\n\n\u003e\u003e\u003e r = RFM(df, customer_id='CustomerID', transaction_date='InvoiceDate', amount='Amount')\n\n\u003e\u003e\u003e r.plot_segment_distribution()\n```\n\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_seg_dist.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n\n# License\n[MIT](https://github.com/sonwanesuresh95/rfm/blob/main/LICENSE)\n\n# Documentation\n\u003c-- Temporarily Hosted Here --\u003e\n## Initialization\nRead required dataframe\n```\n\u003e\u003e\u003e df = pd.read_csv('~./data.csv')\n```\n\nImport RFM package and start rfm analysis automatically:\n```\n\u003e\u003e\u003e from rfm import RFM\n\n\u003e\u003e\u003e r = RFM(df, customer_id='CustomerID', transaction_date='InvoiceDate', amount='Amount') \n\n\u003e\u003e\u003e r.rfm_table\n```\nIf you want to do rfm analysis manually:\n```\n\u003e\u003e\u003e r = RFM(df, customer_id='CustomerID', transaction_date='InvoiceDate', amount='Amount', automated=False)\n```\n\n## Attributes\n\n### RFM.rfm_table\nreturns resultant rfm table df generated with recency, frequency \u0026 monetary values and scores along with segments\n```\n\u003e\u003e\u003e r.rfm_table\n```\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:500px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_table.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n### RFM.segment_table\nreturns segment table df with 10 unique categories i.e. Champions, Loyal Accounts etc. \n```\n\u003e\u003e\u003e r.segment_table\n```\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"height:250px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_segment_table.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n## Methods\n\n### RFM.plot_rfm_histograms()\nPlots recency, frequency and monetary histograms in a single row\n```\n\u003e\u003e\u003e r.plot_rfm_histograms()\n```\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:700px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_histograms.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n### RFM.plot_rfm_order_distribution()\nPlots orders by customer number\n```\n\u003e\u003e\u003e r.plot_rfm_order_distribution()\n```\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:700px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_order_dist.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n### RFM.plot_versace_plot(column1, column2)\nPlots scatterplot of two input columns\n\n```\n\u003e\u003e\u003e r.plot_versace_plot(column1='recency',column2='monetary_value')\n```\n\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_rm.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n```\n\u003e\u003e\u003e r.plot_versace_plot(column1='recency',column2='frequency')\n```\n\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_rf.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n```\n\u003e\u003e\u003e r.plot_versace_plot(column1='frequency',column2='monetary_value')\n```\n\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_fm.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n### RFM.plot_distribution_by_segment(column, take)\nPlots Distribution of input column by segment\n```\n\u003e\u003e\u003e r.plot_distribution_by_segment(column='recency',take='median')\n```\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_mrdian_rec.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n```\n\u003e\u003e\u003e r.plot_distribution_by_segment(column='frequency',take='median')\n```\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_median_freq.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n```\n\u003e\u003e\u003e r.plot_distribution_by_segment(column='monetary_value',take='median')\n```\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_med_mon.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n### RFM.plot_column_distribution(column)\nPlots column distribution of input column\n```\n\u003e\u003e\u003e r.plot_column_distribution(column='recency')\n```\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_col_dist_rec.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n```\n\u003e\u003e\u003e r.plot_column_distribution(column='frequency')\n```\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_col_dist_freq.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n```\n\u003e\u003e\u003e r.plot_column_distribution(column='monetary_value')\n```\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_col_dist_mon.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n### RFM.plot_segment_distribution()\n```\n\u003e\u003e\u003e r.plot_segment_distribution()\n```\nPlots Segment Distribution, i.e. Segments vs no. of customers\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_seg_dist.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n### RFM.find_customers(segment)\nreturns rfm results df with input category\n```\n\u003e\u003e\u003e r.find_customers('Champions')\n```\n\u003cdiv align=\"left\"\u003e\n  \u003cimg style=\"width:550px\" src=\"https://github.com/sonwanesuresh95/rfm/blob/main/example_/rfm_champions.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonwanesuresh95%2Frfm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsonwanesuresh95%2Frfm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonwanesuresh95%2Frfm/lists"}