Project The Battle of Neighborhoods Week 1 Capstone Report

Project Description

Finding a nice neighborhood to live in.

Most adults during their life, have atleast made a single change of living location due to personal or professional reasons. However finding a decent place where all the personal needs are met is highly stressful. Some people enjoy doing the detailed analysis by hand thereby figuring out following information like,

  1. the average rent in a neighborhood,
  2. transport amenities (both public and private),
  3. best schools for kids(if they have any, as this is a very important choice),
  4. average commute time from that neighborhood to work place,
  5. nearest hospitals,
  6. crime rates,
  7. police or communal violence,
  8. political or racial tensions,
  9. public health crisis in the last few years,
  10. tax rates
  11. public places like parks,
  12. places to have leisure sctivities like going to restaurants, movie theaters, saunas, gym, etc.,

These are few common things to consider during a relocation and they are very important for a healthy and stress free life. And doing an Online search for these is time consuming. In this project, we aim to meet atleast some common requirements like (numbers 1, 2, 3, 4, 5, 11, 12) and guide the project users to choose atleast 1 or more neighborhoods for their consideration during their relocation. By rating the neighborhoods based upon the available amenities they have, we can recommend the neighborhood in a city in a ranked order. This is the goal of this project.

Target Audience:-
Someone who wants to relocate to a city.

Stakeholders:-

  1. Someone who wants to relocate to a city.
  2. Myself.

Data Description

We use public libraries and API's in this project. We use Foursquare API, Some common Python Libraries for programming.

Foursquare API:

Foursquare provides a valuable and publically accessible location information like the ameneties in nearby locations. We use their developer tools to access the required information about the neighboords in a city. Using these accessed information we then rank the neighborhoods based on the ameneties they have. These services are free of charge.

We create a Foursquare developer account, and after that we provide some zip codes inside a city and for each zip code or LatLon info(Latitude and Longitude Points) we provided we extract details on the ameneties we expect a neighborhood should have. So we set the radius of this search around to zip code to be around 1km.

Date Type:- JSON

Duration:-
N/A

Description of the data:-
Location coordinates obtained by Foursquare API calls.

Source:- (https://foursquare.com/)

Public Programming Tools:-

We use some public plotting tools like Folium to visualize the neighborhoods in the city we want to relocate. Then based upon the analysis of the Foursquare information we can update the Folium visualization to reflect the number of amenities in a neighborhood.

K-Means Clustering Algorithm on the Data:-

We can use K-Means Clustering algorithm to group amenities in an area, then we can reduce the number of individual amenities comparisons to be done against each neighborhood. We can do these comparisons against the types of amenities, individually, collectively, or alltogether.

Data Analysis


In [4]:
# connect to foursquare from python
# program skeleton source
# http://aimotion.blogspot.com/2011/12/playing-with-foursquare-api-with-python.html
import pyfoursquare as foursquare

client_id = "WOG0BCJ3UMIK5HM5OQOIW3ABJHVGNGKWCDA1OSPTTEE22QF0"
client_secret = "MTTEKQHQ0KL3VXWQ5A43HD4Y3OXPWYBRULM3QS1GPRAYOM2Q"
callback = ''

auth = foursquare.OauthHandler(client_id, client_secret, callback)

#First Redirect the user who wish to authenticate to.
#It will be create the authorization url for your app
auth_url = auth.get_authorization_url()
print("Please authorize:"  + auth_url)

#If the user accepts, it will be redirected back
#to your registered REDIRECT_URI.
#It will give you a code as
#https://YOUR_REGISTERED_REDIRECT_URI/?code=CODE
code = raw_input('The code: ').strip()

#Now your server will make a request for
#the access token. You can save this
#for future access for your app for this user
access_token = auth.get_access_token(code)
print('Your access token is ' + access_token)


---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-43919db6b269> in <module>
      2 # program skeleton source
      3 # http://aimotion.blogspot.com/2011/12/playing-with-foursquare-api-with-python.html
----> 4 import pyfoursquare as foursquare
      5 
      6 client_id = "WOG0BCJ3UMIK5HM5OQOIW3ABJHVGNGKWCDA1OSPTTEE22QF0"

ModuleNotFoundError: No module named 'pyfoursquare'

In [ ]: