Skip to content

bank customer #2118

@qyuanawilliams-commits

Description

@qyuanawilliams-commits

import pandas as pd

Load the CSV file (adjust path if needed)

df = pd.read_csv("BankCustomers (1).csv")

Preview the first few rows

print("First five rows of data:")
print(df.head())

Verify fields

print("\nList of fields (columns):")
print(df.columns)

Completeness check

percent_complete = df.notnull().sum() / len(df) * 100
print("\nPercentage of records with values per field:")
print(percent_complete)

1. Completeness of Customer Income

income_complete_pct = df["Customer Income"].notnull().sum() / len(df) * 100
print(f"\n1) Income data completeness: {income_complete_pct:.1f}% of records have values.")

2. Average income overall and by branch

overall_avg_income = df["Customer Income"].mean()
branch_avg_income = df.groupby("Bank Branch")["Customer Income"].mean()
print(f"\n2) Overall average income: {overall_avg_income:.2f}")
print("Average income by branch:")
print(branch_avg_income)

3. Online-only customers

online_customers = df[df["Bank Branch"] == "Online"]
print(f"\n3) Online-only customers: {len(online_customers)}")

4. Compare online vs physical branch incomes

avg_income_online = online_customers["Customer Income"].mean()
avg_income_physical = df[df["Bank Branch"] != "Online"]["Customer Income"].mean()
print(f"\n4) Average income (Online customers): {avg_income_online:.2f}")
print(f" Average income (Physical branch customers): {avg_income_physical:.2f}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions