1. Install Python
Download the current stable Python installer for your operating system and complete the installation.
Official Python download ↗python --versionOn some Windows systems, use py --version.Load, inspect, clean and summarize a small customer dataset before building your first Ai model.
Project 02 introduces the shared Python and VS Code setup used by later coding projects. Complete this setup once; future projects will link back here instead of repeating it.
Download applications only from their official websites.
Download the current stable Python installer for your operating system and complete the installation.
Official Python download ↗python --versionOn some Windows systems, use py --version.Download Visual Studio Code, run the installer and open the application after installation.
Official VS Code download ↗code --versionYou may also open VS Code from the Start menu.In VS Code, open Extensions, search for Python by Microsoft and select Install.
Microsoft Python extension ↗Python: Select InterpreterRun this command from the VS Code Command Palette.Use Jupyter only if you prefer notebooks. The supplied Python script is enough to complete this project.
Official Jupyter installation ↗pip install jupyterlabSkip this installation when following the script route.Use File Explorer or Finder, then open the complete project folder in VS Code.
project-02-python-data-explorer.data and outputs.project-02-python-data-explorer, then confirm that it appears in the Explorer panel.project-02-python-data-explorer/
├── data/
├── outputs/
├── data-explorer.py
├── README.md
└── requirements.txtUse the Starter Files section below, then move each download into the indicated location.
data/customer-data.csvdata-explorer.pyMove to the project’s main folderrequirements.txtMove to the project’s main folderREADME-template.pdfRead the PDF and use its sections to write your own README.mdProject worksheetOptional planning and findings recordConfirm the files end with .py, .csv, .txt and .pdf. Windows may hide extensions; do not accidentally create names such as data-explorer.py.txt.
In VS Code, select Terminal → New Terminal. Confirm the terminal is inside your project folder, then run:
python -m pip install -r requirements.txt
python -c "import pandas, matplotlib; print('Setup complete')"
python data-explorer.pyReady to begin when: the terminal prints Setup complete, the CSV loads, and the script displays the first data summaries without a file-not-found error.
Create a Python project that loads, inspects, cleans and summarizes customer data. You will understand what the dataset contains before using it for Ai.
project-02-python-data-explorer/
├── data/customer-data.csv
├── outputs/
├── data-explorer.py
├── README.md
└── requirements.txtRun each code block, confirm its output, then mark the step complete.
Prepare pandas for data work and matplotlib for the chart.
pip install pandas matplotlibpandas
matplotlibRead the CSV file and handle a missing-file error clearly.
import pandas as pd
file_path = "data/customer-data.csv"
try:
df = pd.read_csv(file_path)
print("Dataset loaded successfully.")
except FileNotFoundError:
print(f"Dataset not found: {file_path}")Dataset loaded successfully.
Understand its size, columns, values and data types.
print(df.head())
print(df.shape)
print(df.columns)
df.info()Find missing values and duplicates before changing the data.
print("Missing values:")
print(df.isnull().sum())
print("\nDuplicate rows:")
print(df.duplicated().sum())df = df.drop_duplicates()
df["Monthly Spending"] = df["Monthly Spending"].fillna(
df["Monthly Spending"].median()
)Replace each column name with the exact name used in your dataset. Check why a row is duplicated before removing it.
Calculate useful numerical and category summaries.
print(df.describe())
average_spending = df["Monthly Spending"].mean()
average_purchases = df["Number of Purchases"].mean()
print("Average monthly spending:", round(average_spending, 2))
print("Average number of purchases:", round(average_purchases, 2))
print(df["Membership Type"].value_counts())Find high-spending customers and compare membership groups.
high_spending_customers = df[df["Monthly Spending"] > 100]
print(high_spending_customers.head())
membership_summary = (
df.groupby("Membership Type")["Monthly Spending"]
.mean()
.sort_values(ascending=False)
)
print(membership_summary)Visualise average spending across membership groups.
import matplotlib.pyplot as plt
membership_summary.plot(kind="bar")
plt.title("Average Spending by Membership Type")
plt.xlabel("Membership Type")
plt.ylabel("Average Monthly Spending")
plt.tight_layout()
plt.show()A bar chart comparing average spending across membership groups.
I created a Python Data Explorer using pandas. I loaded and inspected a customer dataset, checked data types, handled missing values, removed duplicates, calculated summary statistics and created a chart comparing customer groups. This project developed my basic Python, data-cleaning and exploratory-analysis skills.