Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Python Mini Projects

About

Two Jupyter notebook projects using pandas, seaborn, and scikit-learn:

Project Dataset What it does
911 Call Data 99,492 emergency calls, Dec 2015 – Aug 2016 Feature engineering and exploratory analysis of when and why people call 911
Brain Tumor Survival 20,000 patient records Data cleaning, EDA, and a linear regression predicting survival rate

Both notebooks were run on Python 3.12 and include their outputs, so the charts and results show up directly on GitHub.


1. 911 Call Data

Data: 911.csv: latitude/longitude, description, zip code, title (e.g. EMS: BACK PAINS/INJURY), timestamp, township, and address.

What the notebook does

  1. Explores the raw data: top zip codes and townships by call volume, and the number of unique call titles.
  2. Engineers features:
    • Reason: the department prefix before the colon in title (EMS, Fire, or Traffic)
    • Hour, Month, day_name, and Date pulled from the parsed timestamp
  3. Visualizes call patterns:
    • Call counts by reason, by day of week, and by month (split by reason)
    • Calls per month (bar chart) and calls per date (line chart), overall and separately for each reason
    • An hour-of-day × day-of-week heatmap
    • A correlation matrix of hour, reason, and day (categories converted to numeric codes)
  4. Writes up findings in notes between the charts:
    • EMS is the most common reason for a call and Fire the least.
    • January has the most calls.
    • Volume is lowest around 3–7 AM and peaks around 3–5 PM.
    • September to November are missing because the data ends in August.
  5. Scopes a regression model in a closing note (hour, day, month, and reason as features, R² as the metric) without running it.

Techniques

groupby aggregation and pivot tables turn the flat call log into time-based counts, which feed every chart.


2. Brain Tumor Survival Rate

Data: brain_tumor_dataset.csv: age, gender, tumor type (benign/malignant), size, growth rate, location, histology, stage, three symptoms, radiation/surgery/chemotherapy flags, family history, MRI result, follow-up flag, and survival rate.

Research question: can survival rate be predicted from a patient's clinical characteristics?

What the notebook does

  1. Cleans the data:
    • Forward- and back-fills missing values and removes duplicate rows
    • Drops impossible records: age ≤ 0, negative tumor size, or survival rate outside 0–100
    • Standardizes text categories (gender, location, histology, stage)
  2. Handles outliers: caps age, tumor size, survival rate, and growth rate at the IQR fences (Q1 − 1.5·IQR, Q3 + 1.5·IQR) rather than dropping rows.
  3. Encodes and scales: label-encodes the 14 categorical columns and standardizes the four numeric columns with StandardScaler.
  4. Explores:
    • Correlation heatmap across all features
    • Tumor-size histogram with a density curve
    • Age and survival-rate boxplots by tumor type
    • Treatment counts (radiation, chemotherapy, surgery) by tumor type
  5. Models: Survival_Rate ~ Age + Tumor_Size + Tumor_Growth_Rate with scikit-learn's LinearRegression, trained on 60% of the data and tested on 40% (random_state=42).
  6. Evaluates: reports mean squared error and R², then plots actual vs. predicted survival for 100 random test patients.

Survival rate is standardized along with the other numeric columns, so the MSE is in standard-deviation units rather than percentage points.

Techniques

Ordinary least squares regression: finds the weights on age, tumor size, and growth rate that minimize squared prediction error. MSE measures typical error size; is the share of variance in survival rate the model explains.


Running locally

pip install pandas numpy matplotlib seaborn scikit-learn jupyter
jupyter notebook

Each notebook loads its CSV by filename, so launch Jupyter from inside that project's folder (or open the notebook from there).

Built with

Python, pandas, NumPy, Matplotlib, seaborn, scikit-learn, Jupyter.

License

Apache 2.0. See LICENSE.

About

Jupyter notebooks: 911 call pattern EDA (99K calls) and brain tumor survival-rate regression with pandas, seaborn, and scikit-learn.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages