Last active
February 5, 2020 18:05
-
-
Save abbasali-io/ef9aac8fd7338941f2ebe860896833e0 to your computer and use it in GitHub Desktop.
Revisions
-
abbasali-io revised this gist
Feb 5, 2020 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,11 @@ # create price per sqft df['Price_sqft'] = df['Price'] / df['Built_Size'] # most expensive area by price per sqft dfc = df.copy(deep=True) # since we have infinite values in the data, for simplicity sake, we will drop these values dfc = dfc.replace([np.inf, -np.inf], np.nan).dropna(subset=["Price_sqft"], how="all") # replace infinite values with nan all_property_price_sqft = dfc.groupby('Location')['Price_sqft'].mean().sort_values(ascending=False) -
abbasali-io created this gist
Feb 5, 2020 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ # most expensive area by price per sqft dfc = df.copy(deep=True) # since we have infinite values in the data, for simplicity sake, we will drop these values dfc = dfc.replace([np.inf, -np.inf], np.nan).dropna(subset=["Price_sqft", "Price_room", "Rooms_sqft"], how="all") # replace infinite values with nan all_property_price_sqft = dfc.groupby('Location')['Price_sqft'].mean().sort_values(ascending=False) cx = all_property_price_sqft.plot(kind='bar', title="Property sq. ft. Price Distribution in Kuala Lumpur", figsize=(15,10), legend=True, fontsize=10, rot=90) cx.set_xlabel("Locations", fontsize=10) cx.set_ylabel("Expensivness", fontsize=10) plt.show()