<jupyter_start><jupyter_text>EDA  Importing Libraries and Data<jupyter_code>import numpy as np 
import pandas as pd 
import matplotlib.pyplot as plt 
import seaborn as sns 
data = pd.read_csv(r"D:\Utkarsh Mathur\Career\Data Science\Datasets\melbourne housing snapshot\melb_data.csv")<jupyter_output><empty_output><jupyter_text>Initial View of the Data 1. **Rooms**: Number of rooms2. **Price** : Price in dollars3. **Method**: **S** - property sold; **SP** - property sold prior; **PI** - property passed in; **PN** - sold prior not disclosed; **SN** - sold not disclosed; **NB** - no bid; **VB** - vendor bid; **W** - withdrawn prior to auction; **SA** - sold after auction; **SS** - sold after auction price not disclosed. **N/A** - price or highest bid not available. 4. **Type**: **br** - bedroom(s); **h** - house,cottage,villa, semi,terrace; **u** - unit, duplex; **t** - townhouse; dev site - development site; **o res** - other residential. 5. **SellerG**: Real Estate Agent6. **Date**: Date sold 7. **Distance**: Distance from CBD8. **Regionname**: General Region (West, North West, North, North east …etc)9. **Propertycount**: Number of properties that exist in the suburb.10. **Bedroom2** : Scraped  of Bedrooms (from different source)11. **Bathroom**: Number of Bathrooms12. **Car**: Number of carspots13. **Landsize**: Land Size14. **BuildingArea**: Building Size15. **CouncilArea**: Governing council for the area<jupyter_code>data.head()
data.describe(include="all")
data.isnull().sum()
data.shape
data.columns<jupyter_output><empty_output><jupyter_text>Information Stored in all the Columns<jupyter_code># List of all the suburbs
data.Suburb.value_counts()
# No. of Rooms.
data.Rooms.value_counts()
# Types of houses
data.Type.value_counts()
# Methods through which the houses have been sold.
data.Method.value_counts()
data.Postcode.value_counts()
# The names of the sellers or brokers of the houses.
data.SellerG.value_counts()
# That the distance distribution of houses from CBD
data.Distance.describe()
# List of all the postal codes included.
data.Postcode.value_counts()
# No. of scraped bedrooms in the house
data.Bedroom2.value_counts()
# No. of bathrooms
data.Bathroom.value_counts()
# Data of the car parking spots in the house.
data.Car.value_counts(), data.Car.mean(), data.Car.median()
# The value trend of Landsize of the houses. 
data.Landsize.describe()
# The general trends of Council Area
data.CouncilArea.value_counts()<jupyter_output><empty_output><jupyter_text>Now we know that lattitude and longitude are location specific so we need not worry how it is changing.<jupyter_code># The list of region names
data.Regionname.value_counts()
# Understanding Propertycount column
data.Propertycount.value_counts()
data.Propertycount.describe()
# And finally the trend of prices of the houses
data.Price.describe()<jupyter_output><empty_output><jupyter_text>Filling the Data null values<jupyter_code>data.Car = data.Car.fillna(data.Car.median())
data.isnull().sum()<jupyter_output><empty_output><jupyter_text>Data Preparation Initially the data has 20 features and a price columns. But we need to remove some of the uncessary and overlapping features so as to make a better data.I'm decribing why all the features are removed:1) **Date** :- As the data is from a very short span of time the variance in prices with time will be negligible.2) **BuildingArea** :- Due to large number of empty data.3) **YearBuilt** :- Due to large number of empty data.4) **CouncilArea** :- Again in a state the council area doesnot makes much of a difference in the prices of houses.5) **Address** :- As address is a string which is different for every house, it does not make sense to use it in prediciting price.<jupyter_code>data1 = data.drop(['Address','BuildingArea', 'YearBuilt', 'CouncilArea', 'Date'], axis=1)
data1.head()
from sklearn.preprocessing import LabelEncoder
lb = LabelEncoder()
data1['Suburb'] = lb.fit_transform(data1['Suburb']) 
data1['Type'] = lb.fit_transform(data1['Type'])
data1['Method'] = lb.fit_transform(data1['Method'])
data1['SellerG'] = lb.fit_transform(data1['SellerG'])
data1['Regionname'] = lb.fit_transform(data1['Regionname'])
data1.head()
data1.describe(include="all")<jupyter_output><empty_output><jupyter_text>Visualizing the data<jupyter_code>sns.barplot(x='Rooms', y='Price', data=data1)
sns.barplot(x='Type', y='Price', data=data1)
sns.barplot(x='Method', y='Price', data=data1)
sns.barplot(x='Bedroom2', y='Price', data=data1)
sns.barplot(x='Bathroom', y='Price', data=data1)
sns.barplot(x='Car', y='Price', data=data1)
sns.barplot(x='Regionname', y='Price', data=data1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13767182130584193, 'fraction_numerical': 0.01138316151202749, 'mean_word_length': 5.9924924924924925, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '492291', 'license': 'MIT', 'n_tokens_mistral': 1542, 'n_tokens_neox': 1481, 'n_words': 476, 'path': 'EDA.ipynb', 'repo_name': 'dochimekashiariri/Melbourne-Housing-Prices', 'size': '4656'}