initial import and jupyter notebook to check for data issues
This commit is contained in:
45
notebooks/001_data_cleaning_checks.ipynb
Normal file
45
notebooks/001_data_cleaning_checks.ipynb
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "8d393e6d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import sys\n",
|
||||
"import os\n",
|
||||
"import sqlite3\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"# 1. Resolve repository pathing and connect to SQLite\n",
|
||||
"BASE_DIR = os.path.dirname(os.getcwd())\n",
|
||||
"DB_PATH = os.path.join(BASE_DIR, \"data\", \"met_office_weather.db\")\n",
|
||||
"conn = sqlite3.connect(DB_PATH)\n",
|
||||
"\n",
|
||||
"# 2. Extract dataset profile\n",
|
||||
"df = pd.read_sql_query(\"SELECT * FROM historic_weather\", conn)\n",
|
||||
"print(\"--- Dataset Shape ---\")\n",
|
||||
"print(f\"Total Rows: ${df.shape[0]}, Total column: ${df.shape[1]}\\n\")\n",
|
||||
"\n",
|
||||
"print (\"--- Column Data Types & Counts ---\")\n",
|
||||
"print(df.info())\n",
|
||||
"\n",
|
||||
"print(\"\\n--- Missing Values (NaN) Per Feature Column ---\")\n",
|
||||
"print(df.isnull().sum())\n",
|
||||
"\n",
|
||||
"print(\"\\n --- Total Row Logs Collected Per Unique Station ---\")\n",
|
||||
"print(df[\"station_name\"].value_counts())\n",
|
||||
"\n",
|
||||
"conn.close()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"language_info": {
|
||||
"name": "python"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user