RFM Package

https://img.shields.io/pypi/v/rfm_segmentation.svg https://img.shields.io/travis/Esmila/rfm_segmentation.svg Documentation Status

RFM Package for Customer Segmentation

Features

  • rfm_score_generator(data,totalPaid, day_bought,customerID, invoiceNo = “”, format_ = ‘%d.%m.%Y’, R_w=0.15, F_w=0.28, M_w =0.57):

    data : the data of customers you want to segment

    totalPaid : the monetary value (quantity * unit_price)

    day_bought : the date of the purchase

    customerID : unique identifier for each customer

    invoiceNounique identifier for each purchase

    (Default value = “”), if missing take date of each purchase

    format_the date format for day_bought column

    (Default value = ‘%d.%m.%Y’)

    R_wthe weight given to Recency to calculate RFM Score

    (Default value = 0.15)

    F_wthe weight given to Frequency to calculate RFM Score

    (Default value = 0.28)

    M_wthe weight given to Monetary value to calculate RFM Score

    (Default value = 0.57)

    Returns : The RFM (dataframe) with added columns of Recency, Freqency, Monetary Ranks both normalized and not normalized, RFM Score, and the Segment the Customer belongs to, e.g Loyal customer. The Maximum RFM Score is 5.

  • rfm_tree_map(data,totalPaid, day_bought,customerID, invoiceNo = “”, format_ = ‘%d.%m.%Y’, R_w=0.15, F_w=0.28, M_w =0.57, color_ = px.colors.sequential.matter):

    “””

    data : the data of customers you want to segment

    totalPaid : the monetary value (quantity * unit_price)

    day_bought : the date of the purchase

    customerID : unique identifier for each customer

    invoiceNounique identifier for each purchase

    (Default value = “”), if missing take date of each purchase

    format_the date format for day_bought column

    (Default value = ‘%d.%m.%Y’)

    R_wthe weight given to Recency to calculate RFM Score

    (Default value = 0.15)

    F_wthe weight given to Frequency to calculate RFM Score

    (Default value = 0.28)

    M_wthe weight given to Monetary value to calculate RFM Score

    (Default value = 0.57)

    color_the colors for treemap

    (Default value = px.colors.sequential.matter)

    Returns : The RFM tree map

  • rfm_pie_chart(data,totalPaid, day_bought,customerID, invoiceNo = “”, format_ = ‘%d.%m.%Y’, R_w=0.15, F_w=0.28, M_w =0.57, color_ = px.colors.sequential.matter):

    “””

    data : the data of customers you want to segment

    totalPaid : the monetary value (quantity * unit_price)

    day_bought : the date of the purchase

    customerID : unique identifier for each customer

    invoiceNounique identifier for each purchase

    (Default value = “”), if missing take date of each purchase

    format_the date format for day_bought column

    (Default value = ‘%d.%m.%Y’)

    R_wthe weight given to Recency to calculate RFM Score

    (Default value = 0.15)

    F_wthe weight given to Frequency to calculate RFM Score

    (Default value = 0.28)

    M_wthe weight given to Monetary value to calculate RFM Score

    (Default value = 0.57)

    color_the colors for treemap

    (Default value = px.colors.sequential.matter)

    Returns : The RFM pie chart

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.