18 KiB
18 KiB
!pip3 install -q kaggle
!kaggle datasets download amalab182/property-salesmelbourne-city
!mkdir -p data
!unzip -o property-salesmelbourne-city.zip -d data
!rm property-salesmelbourne-city.zip
!ls data
[1m[[0m[34;49mnotice[0m[1;39;49m][0m[39;49m A new release of pip available: [0m[31;49m22.2.1[0m[39;49m -> [0m[32;49m23.0.1[0m [1m[[0m[34;49mnotice[0m[1;39;49m][0m[39;49m To update, run: [0m[32;49mpip3 install --upgrade pip[0m Downloading property-salesmelbourne-city.zip to /Users/mmoryl/Projects/UAM/ium_s487183 0%| | 0.00/589k [00:00<?, ?B/s] 100%|████████████████████████████████████████| 589k/589k [00:00<00:00, 7.61MB/s] Archive: property-salesmelbourne-city.zip inflating: data/Property Sales of Melbourne City.csv Property Sales of Melbourne City.csv
!pip3 install pandas
import pandas as pd
sells = pd.read_csv('data/Property Sales of Melbourne City.csv')
sells
# sells["Car Model"].value_counts()
# len(sells.index)
Requirement already satisfied: pandas in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (1.5.3) Requirement already satisfied: pytz>=2020.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pandas) (2023.2) Requirement already satisfied: python-dateutil>=2.8.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pandas) (2.8.2) Requirement already satisfied: numpy>=1.21.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pandas) (1.24.2) Requirement already satisfied: six>=1.5 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0) [1m[[0m[34;49mnotice[0m[1;39;49m][0m[39;49m A new release of pip available: [0m[31;49m22.2.1[0m[39;49m -> [0m[32;49m23.0.1[0m [1m[[0m[34;49mnotice[0m[1;39;49m][0m[39;49m To update, run: [0m[32;49mpip3 install --upgrade pip[0m
Unnamed: 0 | Suburb | Address | Rooms | Type | Price | Method | SellerG | Date | Distance | ... | Bathroom | Car | Landsize | BuildingArea | YearBuilt | CouncilArea | Lattitude | Longtitude | Regionname | Propertycount | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | Abbotsford | 85 Turner St | 2 | h | 1480000 | S | Biggin | 3/12/2016 | 2.5 | ... | 1.0 | 1.0 | 202.0 | NaN | NaN | Yarra | -37.79960 | 144.99840 | Northern Metropolitan | 4019.0 |
1 | 2 | Abbotsford | 25 Bloomburg St | 2 | h | 1035000 | S | Biggin | 4/02/2016 | 2.5 | ... | 1.0 | 0.0 | 156.0 | 79.0 | 1900.0 | Yarra | -37.80790 | 144.99340 | Northern Metropolitan | 4019.0 |
2 | 4 | Abbotsford | 5 Charles St | 3 | h | 1465000 | SP | Biggin | 4/03/2017 | 2.5 | ... | 2.0 | 0.0 | 134.0 | 150.0 | 1900.0 | Yarra | -37.80930 | 144.99440 | Northern Metropolitan | 4019.0 |
3 | 5 | Abbotsford | 40 Federation La | 3 | h | 850000 | PI | Biggin | 4/03/2017 | 2.5 | ... | 2.0 | 1.0 | 94.0 | NaN | NaN | Yarra | -37.79690 | 144.99690 | Northern Metropolitan | 4019.0 |
4 | 6 | Abbotsford | 55a Park St | 4 | h | 1600000 | VB | Nelson | 4/06/2016 | 2.5 | ... | 1.0 | 2.0 | 120.0 | 142.0 | 2014.0 | Yarra | -37.80720 | 144.99410 | Northern Metropolitan | 4019.0 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
18391 | 23540 | Williamstown | 8/2 Thompson St | 2 | t | 622500 | SP | Greg | 26/08/2017 | 6.8 | ... | 2.0 | 1.0 | NaN | 89.0 | 2010.0 | NaN | -37.86393 | 144.90484 | Western Metropolitan | 6380.0 |
18392 | 23541 | Williamstown | 96 Verdon St | 4 | h | 2500000 | PI | Sweeney | 26/08/2017 | 6.8 | ... | 1.0 | 5.0 | 866.0 | 157.0 | 1920.0 | NaN | -37.85908 | 144.89299 | Western Metropolitan | 6380.0 |
18393 | 23544 | Yallambie | 17 Amaroo Wy | 4 | h | 1100000 | S | Buckingham | 26/08/2017 | 12.7 | ... | 3.0 | 2.0 | NaN | NaN | NaN | NaN | -37.72006 | 145.10547 | Northern Metropolitan | 1369.0 |
18394 | 23545 | Yarraville | 6 Agnes St | 4 | h | 1285000 | SP | Village | 26/08/2017 | 6.3 | ... | 1.0 | 1.0 | 362.0 | 112.0 | 1920.0 | NaN | -37.81188 | 144.88449 | Western Metropolitan | 6543.0 |
18395 | 23546 | Yarraville | 33 Freeman St | 4 | h | 1050000 | VB | Village | 26/08/2017 | 6.3 | ... | 2.0 | 2.0 | NaN | 139.0 | 1950.0 | NaN | -37.81829 | 144.87404 | Western Metropolitan | 6543.0 |
18396 rows × 22 columns
!pip3 install scikit-learn
from sklearn.model_selection import train_test_split