{"id":25175088,"url":"https://github.com/sarahm44/rental-analysis","last_synced_at":"2026-05-03T06:31:57.924Z","repository":{"id":53708529,"uuid":"473395685","full_name":"sarahm44/rental-analysis","owner":"sarahm44","description":"An interactive dashboard displaying analysis of Toronto real estate data using PyViz, Plotly and MapBox API.  ","archived":false,"fork":false,"pushed_at":"2022-08-05T10:54:37.000Z","size":4525,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-09T12:32:00.182Z","etag":null,"topics":["chart","charts","dashboard","fintech","mapbox-api","plotly","plotly-dash","python3","pyviz","real-estate","real-estate-analysis"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sarahm44.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-23T23:50:48.000Z","updated_at":"2024-06-01T09:46:10.000Z","dependencies_parsed_at":"2022-09-03T23:22:47.919Z","dependency_job_id":null,"html_url":"https://github.com/sarahm44/rental-analysis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarahm44%2Frental-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarahm44%2Frental-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarahm44%2Frental-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarahm44%2Frental-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sarahm44","download_url":"https://codeload.github.com/sarahm44/rental-analysis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247103299,"owners_count":20884023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chart","charts","dashboard","fintech","mapbox-api","plotly","plotly-dash","python3","pyviz","real-estate","real-estate-analysis"],"created_at":"2025-02-09T12:28:50.722Z","updated_at":"2026-05-03T06:31:52.898Z","avatar_url":"https://github.com/sarahm44.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Toronto Rental Analysis\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/toronto.jpg)\n\n## Table of Contents\n- [Overview](#overview)\n- [Rental Analysis](#rental-analysis)\n- [Dashboard](#dashboard)\n- [Environment](#environment)\n- [How to Run the Dashboard](#how-to-run-the-dashboard)\n\n## Overview\n\nI created an interactive dashboard using Toronto real estate data, including [Toronto Census Data](https://github.com/sarahm44/rental-analysis/blob/main/toronto_neighbourhoods_census_data.csv) and [Toronto Neighbourhood Coordinates](https://github.com/sarahm44/rental-analysis/blob/main/toronto_neighbourhoods_coordinates.csv), with the help of the [Mapbox API](https://www.mapbox.com/).\n\nThis dashboard's goal is to provide charts, maps, and interactive visualizations that help customers explore the data and determine if they want to invest in rental properties in Toronto.\n\n## Rental Analysis\n\nThe code for the rental analysis is contained in [rental_analysis.ipynb](https://github.com/sarahm44/rental-analysis/blob/main/rental_analysis.ipynb).\n\n### Dwelling Types Per Year\nThis section calculates the number of dwelling types per year and visualizes the results as a bar chart using the Pandas plot function.\n\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/dwelling_types01.png)\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/dwelling_types02.png)\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/dwelling_types03.png)\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/dwelling_types04.png)\n\n### Average Monthly Shelter Costs in Toronto Per Year\n\nThis section visualizes the average monthly shelter costs per year to better understand the rental income trends over time. See below the average (mean) shelter cost for owned and rented dwellings per year:\n\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/shelter_costs.png)\n\n### Average House Value per Year\n\nThis section determines the average house value per year. An investor may want to better understand the sales price of the rental property over time. For example, a customer will want to know if they should expect an increase or decrease in the property value over time so they can determine how long to hold the rental property.\n\nSee below the average house value in Toronto per year:\n\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/house_value.png)\n\n### Average House Value by Neighbourhood\n\nThis section compares the house value by neighbourhood. By using `hvplot`, the graph includes an interactive dropdown selector for the neighbourhood. See in the image below:\n\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/value_by_neighbourhood.png)\n\n### Number of Dwelling Types per Year\n\nThis section visualizes the number of dwelling types per year in each neighbourhood. This provides investors with a tool to understand the evolution of dwelling types over the years.\n\nBy using `hvplot`, the graph includes an interactive visualization of the average number of dwelling types per year with a dropdown selector for the neighbourhood. See in the image below\n\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/dt_per_year.png)\n\n### Top 10 Most Expensive Neighbourhoods\n\nIn order to ascertain which neighbourhoods are the most expensive, I calculated the mean house value for each neighbourhood and then sorted the values to obtain the top 10 most expensive neighbourhoods on average. \n\nThe results are plotted as a bar chart:\n\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/10_most_expensive.png)\n\n### Neighbourhood Map\n\nIn this final section I read in neighbourhood location data and built an interactive map with the average prices per neighbourhood. A scatter Mapbox object from Plotly express was used to create the visualization.\n\nSee the visualisation below:\n\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/map.png)\n\n### Cost Analysis\n\nSee below a bar chart row facet created to plot the average house values for all Toronto neighbourhoods per year:\n\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/value_neighbourhood.png)\n\nSee below a sunburst chart to conduct a cost analysis of the most expensive neighbourhoods in Toronto per year:\n\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/sunburst.png)\n\n## Dashboard\n\nThe [dashboard.ipynb](https://github.com/sarahm44/rental-analysis/blob/main/dashboard.ipynb) notebook contains the dashboard code. \n\nSee the dashboard below:\n\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/dashboard.png)\n\n## Environment\n\nThis repo utilises PyViz. It is recommended the following are installed in a new environment.\n\n### New Environment\n\nCreate a new environment using:\n\n```shell\nconda update anaconda\nconda create -n pyvizenv python=3.7 anaconda -y\nconda activate pyvizenv\n```\n\n### Before You Install PyViz Dependencies\n\nBefore installing the PyViz dependencies, you need to install a couple of libraries. First, install the `python-dotenv` library using `pip` to work with environment variables.\n\n```shell\npip install python-dotenv\n```\n\nNext, install the `nb_conda` package that will allow you to switch between virtual environments in Jupyter lab.\n\n```shell\nconda install -c anaconda nb_conda -y\n```\n\n### PyViz and its Dependencies\n\nFollow the next steps to install PyViz and all its dependencies in your Python virtual environment.\n\n1. Download the PyViz dependencies **nodejs** and **npm** (included in nodejs).\n\n    ```shell\n    conda install -c conda-forge nodejs=12 -y\n    ```\n\n2. Use the `conda install` command to install the following packages. Note: On some of these installs, you may get a message that says that the requested packages are already installed. That is fine. Conda is really good at installing all of the required dependencies between these tools.\n\n    ```shell\n    conda install -c pyviz holoviz -y\n    conda install -c plotly plotly -y\n    conda install -c conda-forge jupyterlab=2.2 -y\n    ```\n\n3. Use pip to install the correct versions of `matplotlib` and `numpy` using the following commands:\n\n  ```shell\n  pip install numpy==1.19\n  pip install matplotlib==3.0.3\n  ```\n\n4. PyViz installation also requires the installation of Jupyter Lab extensions. These extensions are used to render PyViz plots in Jupyter Lab. Execute the below commands to install the necessary Jupyter Lab extensions for PyViz and Plotly Express. \n\n    * **IMPORTANT:** _In some installation cases you may encounter the following warning. If you do, **continue with the installations as indicated**, as this warning will **not** affect your code._\n\n      ```\n      Config option `kernel_spec_manager_class` not recognized by `EnableNBExtensionApp`\n      ```\n\n    * Set `NODE_OPTIONS` to prevent \"JavaScript heap out of memory\" errors during extension installation:\n\n      ```shell\n      # (OS X/Linux)\n      export NODE_OPTIONS=--max-old-space-size=4096\n\n      # (Windows)\n      set NODE_OPTIONS=--max-old-space-size=4096\n      ```\n\n    * Install the Jupyter Lab extensions: \n\n      ```shell\n      jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build\n\n      jupyter labextension install jupyterlab-plotly --no-build\n\n      jupyter labextension install plotlywidget --no-build\n\n      jupyter labextension install @pyviz/jupyterlab_pyviz --no-build\n      ```\n\n    * Build the extensions (This may take a few minutes):\n\n      ```shell\n      jupyter lab build\n      ```\n    \n    * Using the `build` and `--no-build` flags allows the machine to build all four extensions simultaneously, otherwise you will have to wait several minutes in between in each installation.\n        \n    * After the build, unset the node options that you used above:\n\n      ```shell\n      # Unset NODE_OPTIONS environment variable\n      # (OS X/Linux)\n      unset NODE_OPTIONS\n\n      # (Windows)\n      set NODE_OPTIONS=\n      ```\n\n5. Run the following commands to confirm installation of all PyViz packages. Look for version numbers with at least the following versions.  \n\n      ```shell\n      conda list nodejs\n      conda list holoviz\n      conda list hvplot\n      conda list panel\n      conda list plotly\n      ```\n\n      ```text\n      nodejs                    12.0.0\n      holoviz                   0.11.3\n      hvplot                    0.7.1\n      panel                     0.10.3\n      plotly                    4.14.3\n      numpy                     1.19\n      matplotlib                3.0.3\n      ```\n\n6. You will also need to register for a public mapbox API key, which can be obtained via [this sign-up link](https://account.mapbox.com/auth/signup/). Detailed information on how Mapbox can be used to generate plots can be found on [Plotly's documentation page](https://plotly.com/python/scattermapbox/#mapbox-access-token-and-base-map-configuration).\n\n## How to Run the Dashboard\n\n![](https://github.com/sarahm44/rental-analysis/blob/main/Images/dashboard.png)\n\n### Running the Dashboard\nIn order to run the Dashboard, run the code in **dashboard.ipynb** file.\nAt code block titled \"Serve the Panel Dashboard\", run the code \"dashboard.servable()\".\nThe output will be the Dashboard.\n\n### Interacting with the Dashboard\nYou can navigate the data by clicking on each tab at the top of the Dashboard.\nSome of the charts and graphs are interactive. See details to navigate each tab below.\n\n| Tab           | Instructions | \n| ------------- |-------------| \n| Welcome      | You can zoom in and out on the map of Toronto, and navigate around the map. Hover your cursor over a dot on the map to view more data associated with that neighbourhood. | \n| Yearly Market Analysis     | These graphs are static, but you can scroll across or up and down to view. |  \n| Shelter Cost vs House Value | These graphs are static, but you can scroll across or up and down to view. |  \n| Neighbourhood Analysis | On each chart use the dropdown menu to view data for different neighbourhoods. You can also navigate around these graphs through tools such as zoom, pan etc.|\n|Top Expensive Neighbourhoods | These charts are also interactive. Zoom or move around on the bar chart. On the sunburst chart you can hover your cursor to view more data.|\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarahm44%2Frental-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsarahm44%2Frental-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarahm44%2Frental-analysis/lists"}