{ "nbformat": 4, "nbformat_minor": 5, "metadata": { "kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"name": "python", "version": "3.10.0"} }, "cells": [ { "cell_type": "markdown", "metadata": {}, "source": ["# ANN Assignment\nStudent: Sample Student\nDate: 2025-01-15"] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "# Load dataset\n", "np.random.seed(42)\n", "data = {\n", " 'age': np.random.randint(20, 60, 100),\n", " 'salary': np.random.normal(50000, 15000, 100),\n", " 'department': np.random.choice(['HR', 'Eng', 'Sales', None], 100),\n", " 'years_exp': np.random.randint(0, 20, 100)\n", "}\n", "df = pd.DataFrame(data)\n", "print(df.shape)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Data cleaning — using fillna(0) incorrectly\n", "df2 = df.fillna(0)\n", "print(df2.isnull().sum())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Single visualisation — missing second plot\n", "plt.hist(df2['salary'], bins=20, color='steelblue')\n", "plt.show()" ] } ] }