Skip to content

04. Data Preparation

Celeste Neo edited this page Nov 5, 2024 · 29 revisions

Data Cleaning processes

The data cleaning process is crucial for ensuring our dataset's accuracy and reliability. Below are the key steps we followed in this project:

1. Data Assessment

  • Actions: Analyzed the structure and types of data, looking for missing values, duplicates, and inconsistencies.

2. Handling Missing Values

  • Actions:
    • Identified columns with missing values.
    • Customer Metrics: Chose to impute missing values with 0 to ensure consistency, especially for features where a lack of data might indicate no applicable information (e.g., new customers).

3. Removing Duplicates

  • Actions: Remove duplicate entries to avoid skewed analysis.

4. Fixing Data Types

  • Actions:
    • Customer Metrics: Change the data type of CouponUsed from float64 to int64 to ensure it only accepts whole numbers.
    • Converted date columns to datetime format.

5. Remove redundant columns

  • Actions:
    • Customer Profile & Customer Metrics: Remove columns with information already found in other datasets to prevent data inconsistencies (e.g. OrderCount and Product Price)
    • Customer Metrics: Dropped columns lacking sufficient information (CityTier etc.) or having extremely low correlation with churn to streamline the dataset and focus on the most impactful features for our analysis.

(can remove if no one has it)

6. Correcting Inconsistencies

  • Objective: Standardize the data for accuracy.
  • Actions:
    • (add in if there is)

7. Validation

  • Objective: Confirm the accuracy of the cleaned dataset.
  • Actions:
    • Validated the dataset to ensure that no new errors were introduced during the cleaning process.
    • Conducted initial analyses to confirm that the data behaved as expected.

Feature engineering techniques

Data Augmentation

To ensure consistency across our entire database, which comprises datasets sourced from various origins, we decided to generate synthetic data to standardize key attributes, like the number of customers. This standardization process aims to align the datasets and facilitate comprehensive analysis. Additionally, we hope to prevent the issue of small dataset sizes and ensure that our analyses are robust and reliable.

Customer Dataset

  • CTGAN from SDV package was chosen as the technique for generating synthetic data for Customer Metric Dataset since it is believed that relationships between its features is complicated
  • Merged synthetic generated Customer Profile & Customer Metric Dataset to get a comprehensive Customer dataset.

SQLqueries used for data transformation (with explanations)

Final dataset structure

The dataset consists of multiple tables, each designed to represent different aspects of customer behavior and demographic information. The tables are linked by a unique identifier, CustomerID, to allow for efficient data merging and analysis.

Key Tables

  1. Customer Dataset
    • Description: Contains information about customers.
    • Key Column: CustomerID
    • Columns:
      • CustomerID (int64): Unique identifier for each customer.
      • Age (int64): Age of the customer.
      • Gender (object): Gender of the customer.
      • Churn (int64): Churn Flag (binary)
      • Tenure (float64): Tenure of customer in organization.
      • NumberOfDeviceRegistered (int64): Total devices registered by the customer.
      • HourSpendOnApp (float64): Average hours spent on the app weekly.
      • SatisfactionScore (int64): Satisfaction score of customer on service.
      • CouponUsed (float64): Total number of coupons used in the last month.
      • CashbackAmount (float64): Average cashback in the last month.
    • Row Count: 100,000 rows

Data Relationships

Clone this wiki locally