#!/usr/bin/env python # coding: utf-8 #
#

What Percentage of Sales were Foreclosures in Morgan Hill CA?

#
# #
# #
# Mikaela Rojas | Rojas Realty #
# #
# #
# #
#

Hello!

#

I’m Mikaela Rojas!


#
#
# Thank you for choosing me as your South Bay Realtor! Let's take a
# a look at Morgan Hill CA Foreclosure rates. #
# #
# #
# In[1]: import pandas as pd import matplotlib.pyplot as plt # only needed for advanced plotting import matplotlib.dates as dates plt.style.use('ggplot') get_ipython().run_line_magic('matplotlib', 'inline') # In[8]: # grab Zillow data # Morgan Hill,CA,San Jose,Santa Clara|01424 # FR = Percentage of Sales that were Foreclosures df = pd.read_csv('http://www.quandl.com/api/v3/datasets/ZILL/C01424_FR.csv') df.head(); # In[3]: # convert to date format df['Date'] = pd.to_datetime(df['Date']) # In[4]: # rename columns df.columns = ['Date','Foreclosure_pct'] # In[5]: # set Date to be the index df = df.set_index('Date') # ## Foreclosures for 2015 and 2016 seem to be total opposites. What kind of trend will we have for 2017? # In[6]: # Advanced Plotting #################### fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(13, 5)) fig.subplots_adjust(hspace=1.0) ## Create space between plots # Chart 1 mask1 = df.index.year == 2015 df[mask1].sort_index().plot.bar(ax=axes) # Chart 2 mask1 = df.index.year == 2016 df[mask1].sort_index().plot.bar(ax=axes, alpha=0.4, color='w') # add a little sugar axes.set_title('Forclosure Percentages: 2015 vs 2016') axes.set_ylabel('Forclosure Percentages') axes.legend(["2015","2016"], loc='best'); #

Morgan Hill CA Realtor: ROJAS REALTY

# #
#

the information came from quandl and Zillow

#
# In[7]: from IPython.display import HTML HTML('''
''')