Translate

Sunday, April 23, 2023

New Home Housing Market

The following charts display the trends of new one-family homes sold, new privately owned housing units started, homeownership, and the U.S. National Home Price Index. In recent years, there has been a decline in the number of new homes sold and new housing units started. The U.S. National Home Price Index has also started to decline. Despite these trends, homeownership rates have continued to increase, although the rates of increase have slowed down.
Python codes - import pandas_datareader.data as web import pandas as pd import numpy as np import matplotlib.pyplot as plt start = '1990-01-01' Housing = web.DataReader(['HSN1F'], 'fred', start=start) Diff_Housing = Housing.pct_change(periods=12) * 100 fig, axs = plt.subplots(2, 1) axs[0].bar(Housing.index[-252*20:], Housing['HSN1F'][-252*20:], color='blue', width=20) axs[0].set_title('New One Family Sold') axs[0].set_ylabel('Thousands') axs[1].bar(Diff_Housing.index[-252*10:], Diff_Housing['HSN1F'][-252*10:], color='blue', width=10) axs[1].set_title('New One Family Houses Sold (HSN1F) Changes from same period in previous year') axs[1].set_ylabel('Percent') axs[1].set_xlabel('Year') plt.show() HOUST = web.DataReader(['HOUST'], 'fred', start=start) Diff_HOUST = HOUST.pct_change(periods=12) * 100 fig, axs = plt.subplots(2, 1) axs[0].bar(HOUST.index[-252*20:], HOUST['HOUST'][-252*20:], color='blue', width=20) axs[0].set_title('Housing Starts: Total: New Privately Owned Housing Units Started (HOUST)') axs[0].set_ylabel('Thousands') axs[1].bar(Diff_HOUST.index[-252*20:], Diff_HOUST['HOUST'][-252*20:], color='blue', width=20) axs[1].set_title('Housing Starts: Total: New Privately Owned Housing Units Started (HOUST)') axs[1].set_ylabel('Percent') axs[1].set_xlabel('Year') plt.show() RSAHORUSQ156S = web.DataReader(['RSAHORUSQ156S'], 'fred', start=start) Diff_RSAHORUSQ156S = RSAHORUSQ156S.pct_change(periods=12) * 100 fig, axs = plt.subplots(2, 1) axs[0].plot(RSAHORUSQ156S.index[-252*20:], RSAHORUSQ156S['RSAHORUSQ156S'][-252*20:]) axs[0].set_title('Homeownership Rate for the United States (RSAHORUSQ156S)') axs[0].set_ylabel('Percent') axs[1].bar(Diff_RSAHORUSQ156S.index[-252*20:], Diff_RSAHORUSQ156S['RSAHORUSQ156S'][-252*20:], color='blue', width=20) axs[1].set_title('Homeownership Rate for the United States (RSAHORUSQ156S)') axs[1].set_ylabel('Percent') axs[1].set_xlabel('Year') plt.show() CSUSHPINSA = web.DataReader(['CSUSHPINSA'], 'fred', start=start) Diff_CSUSHPINSA = CSUSHPINSA.pct_change(periods=12) * 100 fig, axs = plt.subplots(2, 1) # plot the time series data axs[0].plot(CSUSHPINSA.index[-252*20:], CSUSHPINSA['CSUSHPINSA'][-252*20:]) axs[0].set_title('U.S. National Home Price Index (CSUSHPINSA)') axs[0].set_ylabel('Index Value') # plot the annual percentage change axs[1].bar(Diff_CSUSHPINSA.index[-252*20:], Diff_CSUSHPINSA['CSUSHPINSA'][-252*20:], color='blue', width=20) axs[1].set_title('Annual Percent Change in U.S. National Home Price Index (CSUSHPINSA)') axs[1].set_ylabel('Percent') axs[1].set_xlabel('Year') # show the plot plt.show()

No comments:

Post a Comment