Giter Club home page Giter Club logo

fischlerben / san-fran-housing-market-visualizations Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 10.55 MB

This project utilizes Python visualizations packages, such as Plotly Express, HVPlot and PyPlot/Matplotlib to create an interactive dashboard exploring the San Francisco real estate housing market. Uses MapBox API.

Shell 0.01% Jupyter Notebook 100.00%
dashboard visualization python-visualization hvplot pyplot plotly-express real-estate san-francisco mapbox-api housing-market-analysis

san-fran-housing-market-visualizations's Introduction

Visualizations with Python

This project utilizes Python visualizations packages, such as Plotly Express, HVPlot and PyPlot/Matplotlib to create an interactive dashboard exploring the 2010-2016 San Francisco housing market. Uses MapBox API to grab data and create visualizations. san_fran

Visualizations of San Francisco Real Estate Housing Market:

Average Housing Units/Year

av_housing_units_per_year

Average Price/Neighborhood (with Interactive Dropdown Selector for Neighborhood)

First, group by year and neighborhood and then create a new dataframe of the mean values:

mean_values = sfo_data.groupby([sfo_data.index, "neighborhood"]).mean()
mean_values.reset_index(inplace=True)

Then use HVPlot to create an interactive line chart of the Average Price/Sq. Foot, with a dropdown selector for the neighborhood:

mean_values.hvplot.line(x="year", y="sale_price_sqr_foot", xlabel= "Year", ylabel="Average Price/Square Foot", groupby="neighborhood")

The above code results in the following interactive line chart: av_price_per_neighborhood

Top 10 Most Expensive Neighborhoods

top_10_most_expensive

Parallel Coordinates Plot to Interactively Filter and Explore Various Factors Related to Sales Price

# Parallel Coordinates Plot
px.parallel_coordinates(ten_most_expensive_df, color="sale_price_sqr_foot", color_continuous_scale=px.colors.sequential.Inferno, title='Average House Value/Neighborhood', labels={'neighborhood': "Neighborhood", 'sale_price_sqr_foot':'Sales Price/Square Foot', 'housing_units':'Housing Units', 'gross_rent':'Gross Rent'})

The above code results in the following interactive parallel coordinates plot: parallel_cats

Parallel Categories Plot to Interactively Filter and Explore Various Factors Related to Sales Price

# Parallel Categories Plot
px.parallel_categories(ten_most_expensive_df, color="sale_price_sqr_foot", color_continuous_scale=px.colors.sequential.Inferno, title='Average House Value/Neighborhood', labels={'neighborhood': "Neighborhood", 'sale_price_sqr_foot':'Sales Price/Square Foot', 'housing_units':'Housing Units', 'gross_rent':'Gross Rent'})

The above code results in the following interactive parallel coordinates plot: parallel_two

Average Value/Neighborhood utilizing MapBox API

First, calculate the mean values for each neighborhood:

mean_neighborhoods = sfo_data.groupby("neighborhood").mean()
mean_neighborhoods = mean_neighborhoods.reset_index()

Then join average values with the neighborhood locations (Lat/Long loaded in with MapBox API):

values_and_locations_df = pd.concat([df_neighborhood_locations, mean_neighborhoods['sale_price_sqr_foot'], mean_neighborhoods['housing_units'], mean_neighborhoods['gross_rent']], axis=1).dropna()

Lastly, create a scatter plot through mapbox to analyze neighborhood info:

map_plot = px.scatter_mapbox(values_and_locations_df, lat="Lat", lon="Lon", size="sale_price_sqr_foot", color="gross_rent", color_continuous_scale=px.colors.cyclical.IceFire, size_max=15, zoom=3, width=1000, hover_name="Neighborhood", title="Average Price/Square Foot and Gross Rent in San Francisco")

The above code results in the following interactive MapBox visualization: mapbox

san-fran-housing-market-visualizations's People

Contributors

fischlerben avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

seanahmad

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.