{"id":1208,"date":"2022-01-13T15:48:14","date_gmt":"2022-01-13T22:48:14","guid":{"rendered":"https:\/\/jeremywhittaker.com\/?p=1208"},"modified":"2022-01-14T09:54:31","modified_gmt":"2022-01-14T16:54:31","slug":"whats-a-better-investment-stocks-or-real-estate","status":"publish","type":"post","link":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/","title":{"rendered":"What&#8217;s a better investment stocks or real estate? Let&#8217;s write some Python code."},"content":{"rendered":"\n<p>I was recently chatting with a buddy about investing in real estate or stocks and which was better. I decided to use Python to analyze what that investment would look like. I used data from <a href=\"https:\/\/fred.stlouisfed.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">FRED <\/a>and <a href=\"https:\/\/pypi.org\/project\/yfinance\/\" target=\"_blank\" rel=\"noreferrer noopener\">yfinance<\/a> which is one of my favorite sources for historical data. Although they do not offer smaller timeframes. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"536\" height=\"300\" data-src=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png\" alt=\"\" class=\"wp-image-1211 lazyload\" data-srcset=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png 536w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1-300x168.png 300w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1-500x280.png 500w\" data-sizes=\"(max-width: 536px) 100vw, 536px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 536px; --smush-placeholder-aspect-ratio: 536\/300;\" \/><\/figure>\n\n\n\n<p>The first thing I&#8217;m going to do is set the dates I&#8217;m interested in. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>beginning_date = '1900-01-01'\ndate_today = datetime.now()\nend_date = date_today\n\n<\/code><\/pre>\n\n\n\n<p>I&#8217;m not going to use FRED and YFinance which are two Python plugins to download historical data. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df = yf.download('^gspc',beginning_date,date_today,progress=True).drop(columns=&#91;'Open','High','Low','Close','Volume']).rename(columns={'Adj Close':'SP500'})\ndf = df.rename(columns={'Adj Close':'SP500'})\n\ndf&#91;'MSPUS'] = pdr.DataReader('MSPUS','fred',beginning_date,date_today)\ndf = df.rename(columns={'MSPUS':'Median_House_price'})\n<\/code><\/pre>\n\n\n\n<p>The stock market index symbol from Yahoo is <a href=\"https:\/\/finance.yahoo.com\/quote\/%5EGSPC\/\" target=\"_blank\" rel=\"noreferrer noopener\">^gspc <\/a>as you can see in the code above. The median house price is <a href=\"https:\/\/fred.stlouisfed.org\/series\/MSPUS\" target=\"_blank\" rel=\"noreferrer noopener\">MSPUS <\/a>from FRED. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df = df.ffill(axis=0)\n\ndf&#91;'Median_House_price_pct_change'] = df&#91;'Median_House_price'].pct_change()*100\ndf&#91;'SP500_pct_change'] = df&#91;'SP500'].pct_change()*100\ndf = df.dropna()\n\ndf&#91;'Median_House_price_pct_change_cumsum'] = df&#91;'Median_House_price_pct_change'].cumsum()\ndf&#91;'SP500_pct_change_cumsum'] = df&#91;'SP500_pct_change'].cumsum()\ndf = df.dropna()\n\ndf&#91;'spread'] = df&#91;'SP500_pct_change_cumsum'].sub(df&#91;'Median_House_price_pct_change_cumsum'])\n\n\ndf.tail(20)<\/code><\/pre>\n\n\n\n<p>The Median house price data is quarterly so I&#8217;m using ffill to forward fill the data. <\/p>\n\n\n\n<p>What I&#8217;m essentially doing next is creating columns in my DataFrame for the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Percent change of asset * 100 to get the return as a percentage.<\/li><li>Cumultively summing all of the returns to get a percentage of return from a specific date.<\/li><li>Calculating the rolling spread between the two assets.<\/li><\/ul>\n\n\n\n<p>My  DataFrame now looks like this. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-1.png\"><img decoding=\"async\" width=\"1024\" height=\"358\" data-src=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-1-1024x358.png\" alt=\"\" class=\"wp-image-1213 lazyload\" data-srcset=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-1-1024x358.png 1024w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-1-300x105.png 300w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-1-768x269.png 768w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-1-1536x537.png 1536w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-1-500x175.png 500w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-1.png 1595w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/358;\" \/><\/a><\/figure>\n\n\n\n<p>If I plot the cumulative sum I get this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fig1 = px.line(df, x=df.index, y='Median_House_price_pct_change_cumsum', color_discrete_sequence=&#91;'red'])\nfig2 = px.line(df, x=df.index, y='SP500_pct_change_cumsum', color_discrete_sequence=&#91;'blue'])\n\nfig3 = go.Figure(data=fig1.data + fig2.data)\nfig3.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-2.png\"><img decoding=\"async\" width=\"1024\" height=\"304\" data-src=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-2-1024x304.png\" alt=\"\" class=\"wp-image-1214 lazyload\" data-srcset=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-2-1024x304.png 1024w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-2-300x89.png 300w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-2-768x228.png 768w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-2-500x148.png 500w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-2.png 1476w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/304;\" \/><\/a><\/figure>\n\n\n\n<p>This shows stocks overall since 1963 have outperformed housing. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  fig1 = px.line(df, x=df.index, y='spread', color_discrete_sequence=&#91;'red'])\n  fig1.show()<\/code><\/pre>\n\n\n\n<p>This code actually plots the spread between the two assets. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-3.png\"><img decoding=\"async\" width=\"1024\" height=\"297\" data-src=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-3-1024x297.png\" alt=\"\" class=\"wp-image-1215 lazyload\" data-srcset=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-3-1024x297.png 1024w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-3-300x87.png 300w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-3-768x223.png 768w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-3-500x145.png 500w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-3.png 1527w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/297;\" \/><\/a><\/figure>\n\n\n\n<p>Now I&#8217;m going to create some more columns in my  DataFrame  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_annual=pd.DataFrame()\ndf_annual&#91;'SP500_pct_change'] = df&#91;'SP500_pct_change'].resample('1A').sum()\ndf_annual&#91;'Median_House_price_pct_change'] = df&#91;'Median_House_price_pct_change'].resample('1A').sum()\ndf_annual&#91;'SP500_pct_change_cumsum'] = df_annual&#91;'SP500_pct_change'].cumsum()\ndf_annual&#91;'Median_House_price_pct_change_cumsum'] =  df_annual&#91;'Median_House_price_pct_change'].cumsum()\ndf_annual.dropna(inplace=True)\ndf_annual&#91;'YoY_spread'] = df_annual&#91;'SP500_pct_change'].sub(df_annual&#91;'Median_House_price_pct_change'])\ndf_annual&#91;'cumulative_spread'] = df_annual&#91;'SP500_pct_change_cumsum'].sub(df_annual&#91;'Median_House_price_pct_change_cumsum'])\n\ndf_annual.drop(df_annual.index&#91;-1],inplace=True)<\/code><\/pre>\n\n\n\n<p>What I&#8217;m doing here is resampling my data to annual as it is broken down currently by quarter. The main difference in this code is I&#8217;m computing an annual year-over-year return of S&amp;P 500 vs. median house price in the United States. Here is the new  DataFrame header.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-4.png\"><img decoding=\"async\" width=\"1024\" height=\"272\" data-src=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-4-1024x272.png\" alt=\"\" class=\"wp-image-1216 lazyload\" data-srcset=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-4-1024x272.png 1024w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-4-300x80.png 300w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-4-768x204.png 768w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-4-500x133.png 500w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-4.png 1242w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/272;\" \/><\/a><\/figure>\n\n\n\n<p>I&#8217;m going to replot this data using the annualized data. Should be almost identical to my first chart. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fig1 = px.line(df_annual, x=df_annual.index, y='Median_House_price_pct_change_cumsum', color_discrete_sequence=&#91;'red'])\nfig2 = px.line(df_annual, x=df_annual.index, y='SP500_pct_change_cumsum', color_discrete_sequence=&#91;'blue'])\n\nfig3 = go.Figure(data=fig1.data + fig2.data)\nfig3.show()\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-5.png\"><img decoding=\"async\" width=\"1024\" height=\"292\" data-src=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-5-1024x292.png\" alt=\"\" class=\"wp-image-1217 lazyload\" data-srcset=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-5-1024x292.png 1024w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-5-300x86.png 300w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-5-768x219.png 768w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-5-500x143.png 500w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-5.png 1508w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/292;\" \/><\/a><\/figure>\n\n\n\n<p>And finally, I&#8217;m computing the annualized year-over-year spread between S&amp;P 500 and median housing prices. This gives a better idea of the annual returns as opposed to the cumulative returns. Where the bar graph is above 0 indicates the stock market outperformed real estate that year. If the bar is below 0 that indicates the real estate market outperformed the stock market. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-6.png\"><img decoding=\"async\" width=\"1024\" height=\"406\" data-src=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-6-1024x406.png\" alt=\"\" class=\"wp-image-1218 lazyload\" data-srcset=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-6-1024x406.png 1024w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-6-300x119.png 300w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-6-768x304.png 768w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-6-1536x609.png 1536w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-6-500x198.png 500w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-6.png 1542w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/406;\" \/><\/a><\/figure>\n\n\n\n<p>And finally the cumulative spread. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-7.png\"><img decoding=\"async\" width=\"1024\" height=\"307\" data-src=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-7-1024x307.png\" alt=\"\" class=\"wp-image-1219 lazyload\" data-srcset=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-7-1024x307.png 1024w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-7-300x90.png 300w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-7-768x231.png 768w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-7-500x150.png 500w, https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/image-7.png 1492w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/307;\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was recently chatting with a buddy about investing in real estate or stocks and which was better. I decided to use Python to analyze what that investment&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1208","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What&#039;s a better investment stocks or real estate? Let&#039;s write some Python code. - Jeremy Whittaker<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What&#039;s a better investment stocks or real estate? Let&#039;s write some Python code. - Jeremy Whittaker\" \/>\n<meta property=\"og:description\" content=\"I was recently chatting with a buddy about investing in real estate or stocks and which was better. I decided to use Python to analyze what that investment...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/\" \/>\n<meta property=\"og:site_name\" content=\"Jeremy Whittaker\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/WhittakerJeremy\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/WhittakerJeremy\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-13T22:48:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-14T16:54:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"536\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"JeremyWhittaker\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"JeremyWhittaker\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/\"},\"author\":{\"name\":\"JeremyWhittaker\",\"@id\":\"https:\/\/new.jeremywhittaker.com\/#\/schema\/person\/ed0edfdefb3e180693efef453372980c\"},\"headline\":\"What&#8217;s a better investment stocks or real estate? Let&#8217;s write some Python code.\",\"datePublished\":\"2022-01-13T22:48:14+00:00\",\"dateModified\":\"2022-01-14T16:54:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/\"},\"wordCount\":378,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/new.jeremywhittaker.com\/#\/schema\/person\/ed0edfdefb3e180693efef453372980c\"},\"image\":{\"@id\":\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/\",\"url\":\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/\",\"name\":\"What's a better investment stocks or real estate? Let's write some Python code. - Jeremy Whittaker\",\"isPartOf\":{\"@id\":\"https:\/\/new.jeremywhittaker.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png\",\"datePublished\":\"2022-01-13T22:48:14+00:00\",\"dateModified\":\"2022-01-14T16:54:31+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#primaryimage\",\"url\":\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png\",\"contentUrl\":\"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png\",\"width\":536,\"height\":300},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/new.jeremywhittaker.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What&#8217;s a better investment stocks or real estate? Let&#8217;s write some Python code.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/new.jeremywhittaker.com\/#website\",\"url\":\"https:\/\/new.jeremywhittaker.com\/\",\"name\":\"Jeremy Whittaker\",\"description\":\"Research, software, markets, housing, and energy\",\"publisher\":{\"@id\":\"https:\/\/new.jeremywhittaker.com\/#\/schema\/person\/ed0edfdefb3e180693efef453372980c\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/new.jeremywhittaker.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/new.jeremywhittaker.com\/#\/schema\/person\/ed0edfdefb3e180693efef453372980c\",\"name\":\"JeremyWhittaker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/c8ac20e6dfa86b5f27ce9bffee4851099770cbea5ae7338a274865bfbc8c0218?s=96&d=retro&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c8ac20e6dfa86b5f27ce9bffee4851099770cbea5ae7338a274865bfbc8c0218?s=96&d=retro&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c8ac20e6dfa86b5f27ce9bffee4851099770cbea5ae7338a274865bfbc8c0218?s=96&d=retro&r=g\",\"caption\":\"JeremyWhittaker\"},\"logo\":{\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/c8ac20e6dfa86b5f27ce9bffee4851099770cbea5ae7338a274865bfbc8c0218?s=96&d=retro&r=g\"},\"sameAs\":[\"http:\/\/www.jeremywhittaker.com\",\"https:\/\/www.facebook.com\/WhittakerJeremy\",\"https:\/\/www.linkedin.com\/in\/jeremywhittaker\/\"],\"url\":\"https:\/\/new.jeremywhittaker.com\/index.php\/author\/jeremywhittaker\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What's a better investment stocks or real estate? Let's write some Python code. - Jeremy Whittaker","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"What's a better investment stocks or real estate? Let's write some Python code. - Jeremy Whittaker","og_description":"I was recently chatting with a buddy about investing in real estate or stocks and which was better. I decided to use Python to analyze what that investment...","og_url":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/","og_site_name":"Jeremy Whittaker","article_publisher":"https:\/\/www.facebook.com\/WhittakerJeremy","article_author":"https:\/\/www.facebook.com\/WhittakerJeremy","article_published_time":"2022-01-13T22:48:14+00:00","article_modified_time":"2022-01-14T16:54:31+00:00","og_image":[{"width":536,"height":300,"url":"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png","type":"image\/png"}],"author":"JeremyWhittaker","twitter_card":"summary_large_image","twitter_image":"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png","twitter_misc":{"Written by":"JeremyWhittaker","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#article","isPartOf":{"@id":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/"},"author":{"name":"JeremyWhittaker","@id":"https:\/\/new.jeremywhittaker.com\/#\/schema\/person\/ed0edfdefb3e180693efef453372980c"},"headline":"What&#8217;s a better investment stocks or real estate? Let&#8217;s write some Python code.","datePublished":"2022-01-13T22:48:14+00:00","dateModified":"2022-01-14T16:54:31+00:00","mainEntityOfPage":{"@id":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/"},"wordCount":378,"commentCount":0,"publisher":{"@id":"https:\/\/new.jeremywhittaker.com\/#\/schema\/person\/ed0edfdefb3e180693efef453372980c"},"image":{"@id":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#primaryimage"},"thumbnailUrl":"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/","url":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/","name":"What's a better investment stocks or real estate? Let's write some Python code. - Jeremy Whittaker","isPartOf":{"@id":"https:\/\/new.jeremywhittaker.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#primaryimage"},"image":{"@id":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#primaryimage"},"thumbnailUrl":"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png","datePublished":"2022-01-13T22:48:14+00:00","dateModified":"2022-01-14T16:54:31+00:00","breadcrumb":{"@id":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#primaryimage","url":"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png","contentUrl":"https:\/\/new.jeremywhittaker.com\/wp-content\/uploads\/2022\/01\/fred-python-1.png","width":536,"height":300},{"@type":"BreadcrumbList","@id":"https:\/\/new.jeremywhittaker.com\/index.php\/2022\/01\/13\/whats-a-better-investment-stocks-or-real-estate\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/new.jeremywhittaker.com\/"},{"@type":"ListItem","position":2,"name":"What&#8217;s a better investment stocks or real estate? Let&#8217;s write some Python code."}]},{"@type":"WebSite","@id":"https:\/\/new.jeremywhittaker.com\/#website","url":"https:\/\/new.jeremywhittaker.com\/","name":"Jeremy Whittaker","description":"Research, software, markets, housing, and energy","publisher":{"@id":"https:\/\/new.jeremywhittaker.com\/#\/schema\/person\/ed0edfdefb3e180693efef453372980c"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/new.jeremywhittaker.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/new.jeremywhittaker.com\/#\/schema\/person\/ed0edfdefb3e180693efef453372980c","name":"JeremyWhittaker","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c8ac20e6dfa86b5f27ce9bffee4851099770cbea5ae7338a274865bfbc8c0218?s=96&d=retro&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c8ac20e6dfa86b5f27ce9bffee4851099770cbea5ae7338a274865bfbc8c0218?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c8ac20e6dfa86b5f27ce9bffee4851099770cbea5ae7338a274865bfbc8c0218?s=96&d=retro&r=g","caption":"JeremyWhittaker"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/c8ac20e6dfa86b5f27ce9bffee4851099770cbea5ae7338a274865bfbc8c0218?s=96&d=retro&r=g"},"sameAs":["http:\/\/www.jeremywhittaker.com","https:\/\/www.facebook.com\/WhittakerJeremy","https:\/\/www.linkedin.com\/in\/jeremywhittaker\/"],"url":"https:\/\/new.jeremywhittaker.com\/index.php\/author\/jeremywhittaker\/"}]}},"_links":{"self":[{"href":"https:\/\/new.jeremywhittaker.com\/index.php\/wp-json\/wp\/v2\/posts\/1208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/new.jeremywhittaker.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/new.jeremywhittaker.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/new.jeremywhittaker.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/new.jeremywhittaker.com\/index.php\/wp-json\/wp\/v2\/comments?post=1208"}],"version-history":[{"count":0,"href":"https:\/\/new.jeremywhittaker.com\/index.php\/wp-json\/wp\/v2\/posts\/1208\/revisions"}],"wp:attachment":[{"href":"https:\/\/new.jeremywhittaker.com\/index.php\/wp-json\/wp\/v2\/media?parent=1208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/new.jeremywhittaker.com\/index.php\/wp-json\/wp\/v2\/categories?post=1208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/new.jeremywhittaker.com\/index.php\/wp-json\/wp\/v2\/tags?post=1208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}