first commit

This commit is contained in:
ChangCL
2025-08-09 22:37:25 +08:00
commit aa3ad0595c
8 changed files with 1913 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@@ -0,0 +1,107 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "28a2e7d9-9ee1-4045-a05c-12eba8683dac",
"metadata": {},
"outputs": [],
"source": [
"# uv add pandas\n",
"# uv add fastparquet"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4b3733cd-3c59-4cb4-a343-4cf75ea36ceb",
"metadata": {},
"outputs": [],
"source": [
"# If not already installed, do: pip install pandas fastparquet\n",
"import pandas as pd\n",
"\n",
"URL_DATA = 'https://storage.data.gov.my/transportation/cars_2025.parquet'\n",
"\n",
"df = pd.read_parquet(URL_DATA)\n",
"if 'date' in df.columns: df['date'] = pd.to_datetime(df['date'])\n",
"\n",
"print(df)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "72c39de4-4b98-4dca-8152-3a51f84d86f5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" date_reg type maker model colour fuel \\\n",
"0 2025-01-01 motokar BYD Seal white electric \n",
"1 2025-01-01 window_van Cam Placer-X yellow greendiesel \n",
"2 2025-01-01 jip Chery Jaecoo J7 green petrol \n",
"3 2025-01-01 jip Chery Jaecoo J7 silver petrol \n",
"4 2025-01-01 jip Chery Tiggo grey petrol \n",
"... ... ... ... ... ... ... \n",
"396824 2025-06-30 window_van Zeekr 009 white electric \n",
"396825 2025-06-30 jip Zeekr X beige electric \n",
"396826 2025-06-30 jip Zeekr X grey electric \n",
"396827 2025-06-30 jip Zeekr X grey electric \n",
"396828 2025-06-30 jip Zeekr X green electric \n",
"\n",
" state \n",
"0 Rakan Niaga \n",
"1 Johor \n",
"2 Rakan Niaga \n",
"3 Rakan Niaga \n",
"4 Rakan Niaga \n",
"... ... \n",
"396824 W.P. Kuala Lumpur \n",
"396825 W.P. Kuala Lumpur \n",
"396826 W.P. Kuala Lumpur \n",
"396827 W.P. Kuala Lumpur \n",
"396828 W.P. Kuala Lumpur \n",
"\n",
"[396829 rows x 7 columns]\n"
]
}
],
"source": [
"import pandas as pd\n",
"\n",
"URL_DATA = 'https://storage.data.gov.my/transportation/cars_2025.parquet'\n",
"\n",
"# Assuming 'your_file.parquet' is the path to your Parquet file\n",
"df = pd.read_parquet(URL_DATA, engine='pyarrow')\n",
"if 'date' in df.columns: df['date'] = pd.to_datetime(df['date'])\n",
"\n",
"# print(df.head())\n",
"print(df)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.11"
}
},
"nbformat": 4,
"nbformat_minor": 5
}