In [0]:
import pandas as pd
In [0]:
# df1 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/big_df_10.csv')
df1 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/big_df_100.csv')
df2 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/big_df_1000.csv')
df3 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/big_df_2000.csv')
df4 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/big_df_4000.csv')
df5 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/big_df_6000.csv')
df6 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/big_df_8000.csv')
df7 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/big_df_10000.csv')
df8 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/big_df_12000.csv')
df9 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/big_df_13900.csv')
df10 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/big_df_-1.csv')
In [0]:
df_all = pd.concat([df1, df2, df3, df4, df5, df6, df7, df8, df9, df10], axis=1)
df = df_all.copy()
df = df.loc[:,~df.columns.duplicated()]
dates = [i for i in range(1997,2030)]
df['dates'] = dates
columns = df.columns.tolist()
columns = columns[-1:] + columns[:-1]
df = df[columns]
df.drop('Unnamed: 0', axis=1, inplace=True)
# df.to_csv('big_df_all.csv', index=False)
df_t = df.set_index('dates').T
# df_t = df.T
# df_t.to_csv('big_df_all_t.csv', index=False)
In [0]:
df_t.reset_index(inplace=True)
In [46]:
df_t.rename(columns={"index": "RegionName"}, inplace=True) 
df_t
Out[46]:
dates RegionName 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029
0 60657 471939.146986 496487.087257 522374.359072 549597.800846 564426.006323 588973.946599 614861.218411 642080.732846 656903.847279 681444.165086 707317.035488 7.345223e+05 7.493324e+05 7.738621e+05 7.997312e+05 8.269365e+05 8.417464e+05 8.662762e+05 8.921453e+05 9.193505e+05 9.341605e+05 9.586903e+05 9.845594e+05 1.041382e+06 1.040300e+06 1.070158e+06 1.101328e+06 1.133797e+06 1.132714e+06 1.162573e+06 1.193742e+06 1.226211e+06 1.225129e+06
1 77494 202222.028612 207762.918144 212961.066732 217816.842570 223657.943941 229198.833509 234396.982068 239252.757916 245093.859298 250638.201717 255840.224392 2.607071e+05 2.665659e+05 2.721364e+05 2.773679e+05 2.850586e+05 2.937513e+05 3.021387e+05 3.101834e+05 3.178857e+05 3.265812e+05 3.349686e+05 3.430133e+05 3.452969e+05 3.580764e+05 3.650972e+05 3.717798e+05 3.781268e+05 3.909063e+05 3.979271e+05 4.046097e+05 4.109567e+05 4.237362e+05
2 60614 796920.397585 824024.164447 849791.908981 874214.243009 869097.909573 896201.676216 921969.420977 946391.754876 941275.421352 968379.178964 994146.907946 1.018569e+06 1.013452e+06 1.040555e+06 1.066322e+06 1.090743e+06 1.085626e+06 1.112729e+06 1.138496e+06 1.162917e+06 1.157800e+06 1.184903e+06 1.210669e+06 1.247033e+06 1.258160e+06 1.279870e+06 1.300220e+06 1.319207e+06 1.330333e+06 1.352044e+06 1.372393e+06 1.391380e+06 1.402507e+06
3 77449 91824.749488 95747.158288 98706.117626 100701.913820 104819.786172 108742.194970 111701.154312 113696.950513 117814.822871 121737.231672 124696.191015 1.266926e+05 1.308134e+05 1.347436e+05 1.377112e+05 1.397210e+05 1.438554e+05 1.477966e+05 1.507758e+05 1.527918e+05 1.569300e+05 1.608726e+05 1.638518e+05 1.512876e+05 1.669226e+05 1.670198e+05 1.661645e+05 1.643636e+05 1.799987e+05 1.800958e+05 1.792405e+05 1.774397e+05 1.930747e+05
4 77084 91459.742472 95429.981924 98406.642481 100389.968950 104448.220793 108418.460261 111395.120826 113378.447305 117437.724067 121408.985719 124386.668479 1.263710e+05 1.304339e+05 1.344147e+05 1.374060e+05 1.394107e+05 1.434962e+05 1.474937e+05 1.504996e+05 1.525123e+05 1.565999e+05 1.605995e+05 1.636055e+05 1.506939e+05 1.666394e+05 1.666729e+05 1.657240e+05 1.637997e+05 1.797452e+05 1.797787e+05 1.788298e+05 1.769055e+05 1.928510e+05
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
13910 47986 66037.989375 66339.088058 66628.620749 66905.727509 64451.358133 64752.456813 65041.989476 65319.096199 62864.709569 63165.685591 63454.504079 6.373083e+04 6.127555e+04 6.157573e+04 6.186435e+04 6.214054e+04 5.968526e+04 5.998544e+04 6.027406e+04 6.055025e+04 5.809497e+04 5.839515e+04 5.868377e+04 6.151348e+04 5.922287e+04 5.947162e+04 5.970535e+04 5.992320e+04 5.763258e+04 5.788133e+04 5.811506e+04 5.833291e+04 5.604229e+04
13911 89155 250691.446764 255028.623188 258459.285007 260983.330300 264084.518904 268421.695325 271852.357148 274376.402445 277477.591049 281814.767023 285245.428393 2.877695e+05 2.908707e+05 2.952078e+05 2.986385e+05 3.011625e+05 3.042637e+05 3.086009e+05 3.120316e+05 3.145556e+05 3.176568e+05 3.219940e+05 3.254246e+05 3.156357e+05 3.295675e+05 3.302840e+05 3.301024e+05 3.290288e+05 3.429606e+05 3.436770e+05 3.434955e+05 3.424218e+05 3.563536e+05
13912 55144 76857.478471 82633.187309 87967.752763 92860.388688 95856.195633 101631.904482 106966.469947 111859.105861 114854.912788 120630.621620 125965.187071 1.308578e+05 1.338536e+05 1.396293e+05 1.449639e+05 1.498565e+05 1.528523e+05 1.586281e+05 1.639626e+05 1.688553e+05 1.718511e+05 1.776268e+05 1.829613e+05 1.840168e+05 1.923046e+05 1.963140e+05 1.998836e+05 2.030155e+05 2.113034e+05 2.153127e+05 2.188823e+05 2.220142e+05 2.303021e+05
13913 4033 444447.599617 466985.532392 489652.665437 512441.900874 511143.936786 533681.869435 556349.002322 579134.788063 577833.185287 600363.857043 623023.102601 6.458045e+05 6.444986e+05 6.670286e+05 6.896879e+05 7.124692e+05 7.111633e+05 7.336934e+05 7.563526e+05 7.791340e+05 7.778281e+05 8.003581e+05 8.230174e+05 8.713253e+05 8.686947e+05 8.916974e+05 9.147987e+05 9.379900e+05 9.353594e+05 9.583622e+05 9.814635e+05 1.004655e+06 1.002024e+06
13914 86343 91454.193554 94682.526922 97183.095405 98956.171309 102173.960151 105402.293517 107902.861999 109675.937901 112893.726742 116122.060107 118622.628589 1.203957e+05 1.236135e+05 1.268418e+05 1.293424e+05 1.311155e+05 1.343333e+05 1.375616e+05 1.400622e+05 1.418352e+05 1.450530e+05 1.482814e+05 1.507819e+05 1.417013e+05 1.536021e+05 1.539259e+05 1.535305e+05 1.524210e+05 1.643219e+05 1.646457e+05 1.642503e+05 1.631408e+05 1.750416e+05

13915 rows × 34 columns

In [0]:
# df_t['roi_28_18'] = df_t[2028] - df_t[2018]
# df_t.to_csv('big_df_all_t.csv', index=False)
# three_zips_csv = three_zips.head(3)
# three_zips_csv.to_csv('three_zips_roi_28_18.csv')
# files.download('three_zips_roi_28_18.csv')
# three_zips = df_t.sort_values(by='roi_28_18', ascending=False)
# df_t['roi_19_18'] = df_t[2019] - df_t[2018]
# df_t.sort_values(by='roi_19_18', ascending=False)
In [92]:
df_t.index
Out[92]:
Index(['60657', '77494', '60614', '77449', '77084', '79936', '60640', '11226',
       '10467', '78660',
       ...
       '43523', '81225', '21405', '45816', '41101', '47986', '89155', '55144',
       '4033', '86343'],
      dtype='object', length=13915)
In [0]:
og_df = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/Zip_Zhvi_SingleFamilyResidence.csv', encoding='latin')
In [0]:
og_df.set_index('RegionName', inplace=True)
In [0]:
# new_df = pd.merge(df_t, og_df, left_index=True, right_index=True)
In [37]:
df_t.reset_indexa
Out[37]:
dates 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029
60657 471939.146986 496487.087257 522374.359072 549597.800846 564426.006323 588973.946599 614861.218411 642080.732846 656903.847279 681444.165086 707317.035488 7.345223e+05 7.493324e+05 7.738621e+05 7.997312e+05 8.269365e+05 8.417464e+05 8.662762e+05 8.921453e+05 9.193505e+05 9.341605e+05 9.586903e+05 9.845594e+05 1.041382e+06 1.040300e+06 1.070158e+06 1.101328e+06 1.133797e+06 1.132714e+06 1.162573e+06 1.193742e+06 1.226211e+06 1.225129e+06
77494 202222.028612 207762.918144 212961.066732 217816.842570 223657.943941 229198.833509 234396.982068 239252.757916 245093.859298 250638.201717 255840.224392 2.607071e+05 2.665659e+05 2.721364e+05 2.773679e+05 2.850586e+05 2.937513e+05 3.021387e+05 3.101834e+05 3.178857e+05 3.265812e+05 3.349686e+05 3.430133e+05 3.452969e+05 3.580764e+05 3.650972e+05 3.717798e+05 3.781268e+05 3.909063e+05 3.979271e+05 4.046097e+05 4.109567e+05 4.237362e+05
60614 796920.397585 824024.164447 849791.908981 874214.243009 869097.909573 896201.676216 921969.420977 946391.754876 941275.421352 968379.178964 994146.907946 1.018569e+06 1.013452e+06 1.040555e+06 1.066322e+06 1.090743e+06 1.085626e+06 1.112729e+06 1.138496e+06 1.162917e+06 1.157800e+06 1.184903e+06 1.210669e+06 1.247033e+06 1.258160e+06 1.279870e+06 1.300220e+06 1.319207e+06 1.330333e+06 1.352044e+06 1.372393e+06 1.391380e+06 1.402507e+06
77449 91824.749488 95747.158288 98706.117626 100701.913820 104819.786172 108742.194970 111701.154312 113696.950513 117814.822871 121737.231672 124696.191015 1.266926e+05 1.308134e+05 1.347436e+05 1.377112e+05 1.397210e+05 1.438554e+05 1.477966e+05 1.507758e+05 1.527918e+05 1.569300e+05 1.608726e+05 1.638518e+05 1.512876e+05 1.669226e+05 1.670198e+05 1.661645e+05 1.643636e+05 1.799987e+05 1.800958e+05 1.792405e+05 1.774397e+05 1.930747e+05
77084 91459.742472 95429.981924 98406.642481 100389.968950 104448.220793 108418.460261 111395.120826 113378.447305 117437.724067 121408.985719 124386.668479 1.263710e+05 1.304339e+05 1.344147e+05 1.374060e+05 1.394107e+05 1.434962e+05 1.474937e+05 1.504996e+05 1.525123e+05 1.565999e+05 1.605995e+05 1.636055e+05 1.506939e+05 1.666394e+05 1.666729e+05 1.657240e+05 1.637997e+05 1.797452e+05 1.797787e+05 1.788298e+05 1.769055e+05 1.928510e+05
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
47986 66037.989375 66339.088058 66628.620749 66905.727509 64451.358133 64752.456813 65041.989476 65319.096199 62864.709569 63165.685591 63454.504079 6.373083e+04 6.127555e+04 6.157573e+04 6.186435e+04 6.214054e+04 5.968526e+04 5.998544e+04 6.027406e+04 6.055025e+04 5.809497e+04 5.839515e+04 5.868377e+04 6.151348e+04 5.922287e+04 5.947162e+04 5.970535e+04 5.992320e+04 5.763258e+04 5.788133e+04 5.811506e+04 5.833291e+04 5.604229e+04
89155 250691.446764 255028.623188 258459.285007 260983.330300 264084.518904 268421.695325 271852.357148 274376.402445 277477.591049 281814.767023 285245.428393 2.877695e+05 2.908707e+05 2.952078e+05 2.986385e+05 3.011625e+05 3.042637e+05 3.086009e+05 3.120316e+05 3.145556e+05 3.176568e+05 3.219940e+05 3.254246e+05 3.156357e+05 3.295675e+05 3.302840e+05 3.301024e+05 3.290288e+05 3.429606e+05 3.436770e+05 3.434955e+05 3.424218e+05 3.563536e+05
55144 76857.478471 82633.187309 87967.752763 92860.388688 95856.195633 101631.904482 106966.469947 111859.105861 114854.912788 120630.621620 125965.187071 1.308578e+05 1.338536e+05 1.396293e+05 1.449639e+05 1.498565e+05 1.528523e+05 1.586281e+05 1.639626e+05 1.688553e+05 1.718511e+05 1.776268e+05 1.829613e+05 1.840168e+05 1.923046e+05 1.963140e+05 1.998836e+05 2.030155e+05 2.113034e+05 2.153127e+05 2.188823e+05 2.220142e+05 2.303021e+05
4033 444447.599617 466985.532392 489652.665437 512441.900874 511143.936786 533681.869435 556349.002322 579134.788063 577833.185287 600363.857043 623023.102601 6.458045e+05 6.444986e+05 6.670286e+05 6.896879e+05 7.124692e+05 7.111633e+05 7.336934e+05 7.563526e+05 7.791340e+05 7.778281e+05 8.003581e+05 8.230174e+05 8.713253e+05 8.686947e+05 8.916974e+05 9.147987e+05 9.379900e+05 9.353594e+05 9.583622e+05 9.814635e+05 1.004655e+06 1.002024e+06
86343 91454.193554 94682.526922 97183.095405 98956.171309 102173.960151 105402.293517 107902.861999 109675.937901 112893.726742 116122.060107 118622.628589 1.203957e+05 1.236135e+05 1.268418e+05 1.293424e+05 1.311155e+05 1.343333e+05 1.375616e+05 1.400622e+05 1.418352e+05 1.450530e+05 1.482814e+05 1.507819e+05 1.417013e+05 1.536021e+05 1.539259e+05 1.535305e+05 1.524210e+05 1.643219e+05 1.646457e+05 1.642503e+05 1.631408e+05 1.750416e+05

13915 rows × 33 columns

In [0]:
new_df = df_t.join(og_df)
In [0]:
test = df_t.copy()
test.reset_index(drop=False, inplace=True)
In [0]:
test.rename(columns={"index": "RegionName"}, inplace=True) 
In [23]:
test
Out[23]:
dates RegionName 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029
0 60657 471939.146986 496487.087257 522374.359072 549597.800846 564426.006323 588973.946599 614861.218411 642080.732846 656903.847279 681444.165086 707317.035488 7.345223e+05 7.493324e+05 7.738621e+05 7.997312e+05 8.269365e+05 8.417464e+05 8.662762e+05 8.921453e+05 9.193505e+05 9.341605e+05 9.586903e+05 9.845594e+05 1.041382e+06 1.040300e+06 1.070158e+06 1.101328e+06 1.133797e+06 1.132714e+06 1.162573e+06 1.193742e+06 1.226211e+06 1.225129e+06
1 77494 202222.028612 207762.918144 212961.066732 217816.842570 223657.943941 229198.833509 234396.982068 239252.757916 245093.859298 250638.201717 255840.224392 2.607071e+05 2.665659e+05 2.721364e+05 2.773679e+05 2.850586e+05 2.937513e+05 3.021387e+05 3.101834e+05 3.178857e+05 3.265812e+05 3.349686e+05 3.430133e+05 3.452969e+05 3.580764e+05 3.650972e+05 3.717798e+05 3.781268e+05 3.909063e+05 3.979271e+05 4.046097e+05 4.109567e+05 4.237362e+05
2 60614 796920.397585 824024.164447 849791.908981 874214.243009 869097.909573 896201.676216 921969.420977 946391.754876 941275.421352 968379.178964 994146.907946 1.018569e+06 1.013452e+06 1.040555e+06 1.066322e+06 1.090743e+06 1.085626e+06 1.112729e+06 1.138496e+06 1.162917e+06 1.157800e+06 1.184903e+06 1.210669e+06 1.247033e+06 1.258160e+06 1.279870e+06 1.300220e+06 1.319207e+06 1.330333e+06 1.352044e+06 1.372393e+06 1.391380e+06 1.402507e+06
3 77449 91824.749488 95747.158288 98706.117626 100701.913820 104819.786172 108742.194970 111701.154312 113696.950513 117814.822871 121737.231672 124696.191015 1.266926e+05 1.308134e+05 1.347436e+05 1.377112e+05 1.397210e+05 1.438554e+05 1.477966e+05 1.507758e+05 1.527918e+05 1.569300e+05 1.608726e+05 1.638518e+05 1.512876e+05 1.669226e+05 1.670198e+05 1.661645e+05 1.643636e+05 1.799987e+05 1.800958e+05 1.792405e+05 1.774397e+05 1.930747e+05
4 77084 91459.742472 95429.981924 98406.642481 100389.968950 104448.220793 108418.460261 111395.120826 113378.447305 117437.724067 121408.985719 124386.668479 1.263710e+05 1.304339e+05 1.344147e+05 1.374060e+05 1.394107e+05 1.434962e+05 1.474937e+05 1.504996e+05 1.525123e+05 1.565999e+05 1.605995e+05 1.636055e+05 1.506939e+05 1.666394e+05 1.666729e+05 1.657240e+05 1.637997e+05 1.797452e+05 1.797787e+05 1.788298e+05 1.769055e+05 1.928510e+05
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
13910 47986 66037.989375 66339.088058 66628.620749 66905.727509 64451.358133 64752.456813 65041.989476 65319.096199 62864.709569 63165.685591 63454.504079 6.373083e+04 6.127555e+04 6.157573e+04 6.186435e+04 6.214054e+04 5.968526e+04 5.998544e+04 6.027406e+04 6.055025e+04 5.809497e+04 5.839515e+04 5.868377e+04 6.151348e+04 5.922287e+04 5.947162e+04 5.970535e+04 5.992320e+04 5.763258e+04 5.788133e+04 5.811506e+04 5.833291e+04 5.604229e+04
13911 89155 250691.446764 255028.623188 258459.285007 260983.330300 264084.518904 268421.695325 271852.357148 274376.402445 277477.591049 281814.767023 285245.428393 2.877695e+05 2.908707e+05 2.952078e+05 2.986385e+05 3.011625e+05 3.042637e+05 3.086009e+05 3.120316e+05 3.145556e+05 3.176568e+05 3.219940e+05 3.254246e+05 3.156357e+05 3.295675e+05 3.302840e+05 3.301024e+05 3.290288e+05 3.429606e+05 3.436770e+05 3.434955e+05 3.424218e+05 3.563536e+05
13912 55144 76857.478471 82633.187309 87967.752763 92860.388688 95856.195633 101631.904482 106966.469947 111859.105861 114854.912788 120630.621620 125965.187071 1.308578e+05 1.338536e+05 1.396293e+05 1.449639e+05 1.498565e+05 1.528523e+05 1.586281e+05 1.639626e+05 1.688553e+05 1.718511e+05 1.776268e+05 1.829613e+05 1.840168e+05 1.923046e+05 1.963140e+05 1.998836e+05 2.030155e+05 2.113034e+05 2.153127e+05 2.188823e+05 2.220142e+05 2.303021e+05
13913 4033 444447.599617 466985.532392 489652.665437 512441.900874 511143.936786 533681.869435 556349.002322 579134.788063 577833.185287 600363.857043 623023.102601 6.458045e+05 6.444986e+05 6.670286e+05 6.896879e+05 7.124692e+05 7.111633e+05 7.336934e+05 7.563526e+05 7.791340e+05 7.778281e+05 8.003581e+05 8.230174e+05 8.713253e+05 8.686947e+05 8.916974e+05 9.147987e+05 9.379900e+05 9.353594e+05 9.583622e+05 9.814635e+05 1.004655e+06 1.002024e+06
13914 86343 91454.193554 94682.526922 97183.095405 98956.171309 102173.960151 105402.293517 107902.861999 109675.937901 112893.726742 116122.060107 118622.628589 1.203957e+05 1.236135e+05 1.268418e+05 1.293424e+05 1.311155e+05 1.343333e+05 1.375616e+05 1.400622e+05 1.418352e+05 1.450530e+05 1.482814e+05 1.507819e+05 1.417013e+05 1.536021e+05 1.539259e+05 1.535305e+05 1.524210e+05 1.643219e+05 1.646457e+05 1.642503e+05 1.631408e+05 1.750416e+05

13915 rows × 34 columns

In [0]:
test.set_index('RegionName', inplace=True)
In [26]:
test
Out[26]:
dates 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029
RegionName
60657 471939.146986 496487.087257 522374.359072 549597.800846 564426.006323 588973.946599 614861.218411 642080.732846 656903.847279 681444.165086 707317.035488 7.345223e+05 7.493324e+05 7.738621e+05 7.997312e+05 8.269365e+05 8.417464e+05 8.662762e+05 8.921453e+05 9.193505e+05 9.341605e+05 9.586903e+05 9.845594e+05 1.041382e+06 1.040300e+06 1.070158e+06 1.101328e+06 1.133797e+06 1.132714e+06 1.162573e+06 1.193742e+06 1.226211e+06 1.225129e+06
77494 202222.028612 207762.918144 212961.066732 217816.842570 223657.943941 229198.833509 234396.982068 239252.757916 245093.859298 250638.201717 255840.224392 2.607071e+05 2.665659e+05 2.721364e+05 2.773679e+05 2.850586e+05 2.937513e+05 3.021387e+05 3.101834e+05 3.178857e+05 3.265812e+05 3.349686e+05 3.430133e+05 3.452969e+05 3.580764e+05 3.650972e+05 3.717798e+05 3.781268e+05 3.909063e+05 3.979271e+05 4.046097e+05 4.109567e+05 4.237362e+05
60614 796920.397585 824024.164447 849791.908981 874214.243009 869097.909573 896201.676216 921969.420977 946391.754876 941275.421352 968379.178964 994146.907946 1.018569e+06 1.013452e+06 1.040555e+06 1.066322e+06 1.090743e+06 1.085626e+06 1.112729e+06 1.138496e+06 1.162917e+06 1.157800e+06 1.184903e+06 1.210669e+06 1.247033e+06 1.258160e+06 1.279870e+06 1.300220e+06 1.319207e+06 1.330333e+06 1.352044e+06 1.372393e+06 1.391380e+06 1.402507e+06
77449 91824.749488 95747.158288 98706.117626 100701.913820 104819.786172 108742.194970 111701.154312 113696.950513 117814.822871 121737.231672 124696.191015 1.266926e+05 1.308134e+05 1.347436e+05 1.377112e+05 1.397210e+05 1.438554e+05 1.477966e+05 1.507758e+05 1.527918e+05 1.569300e+05 1.608726e+05 1.638518e+05 1.512876e+05 1.669226e+05 1.670198e+05 1.661645e+05 1.643636e+05 1.799987e+05 1.800958e+05 1.792405e+05 1.774397e+05 1.930747e+05
77084 91459.742472 95429.981924 98406.642481 100389.968950 104448.220793 108418.460261 111395.120826 113378.447305 117437.724067 121408.985719 124386.668479 1.263710e+05 1.304339e+05 1.344147e+05 1.374060e+05 1.394107e+05 1.434962e+05 1.474937e+05 1.504996e+05 1.525123e+05 1.565999e+05 1.605995e+05 1.636055e+05 1.506939e+05 1.666394e+05 1.666729e+05 1.657240e+05 1.637997e+05 1.797452e+05 1.797787e+05 1.788298e+05 1.769055e+05 1.928510e+05
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
47986 66037.989375 66339.088058 66628.620749 66905.727509 64451.358133 64752.456813 65041.989476 65319.096199 62864.709569 63165.685591 63454.504079 6.373083e+04 6.127555e+04 6.157573e+04 6.186435e+04 6.214054e+04 5.968526e+04 5.998544e+04 6.027406e+04 6.055025e+04 5.809497e+04 5.839515e+04 5.868377e+04 6.151348e+04 5.922287e+04 5.947162e+04 5.970535e+04 5.992320e+04 5.763258e+04 5.788133e+04 5.811506e+04 5.833291e+04 5.604229e+04
89155 250691.446764 255028.623188 258459.285007 260983.330300 264084.518904 268421.695325 271852.357148 274376.402445 277477.591049 281814.767023 285245.428393 2.877695e+05 2.908707e+05 2.952078e+05 2.986385e+05 3.011625e+05 3.042637e+05 3.086009e+05 3.120316e+05 3.145556e+05 3.176568e+05 3.219940e+05 3.254246e+05 3.156357e+05 3.295675e+05 3.302840e+05 3.301024e+05 3.290288e+05 3.429606e+05 3.436770e+05 3.434955e+05 3.424218e+05 3.563536e+05
55144 76857.478471 82633.187309 87967.752763 92860.388688 95856.195633 101631.904482 106966.469947 111859.105861 114854.912788 120630.621620 125965.187071 1.308578e+05 1.338536e+05 1.396293e+05 1.449639e+05 1.498565e+05 1.528523e+05 1.586281e+05 1.639626e+05 1.688553e+05 1.718511e+05 1.776268e+05 1.829613e+05 1.840168e+05 1.923046e+05 1.963140e+05 1.998836e+05 2.030155e+05 2.113034e+05 2.153127e+05 2.188823e+05 2.220142e+05 2.303021e+05
4033 444447.599617 466985.532392 489652.665437 512441.900874 511143.936786 533681.869435 556349.002322 579134.788063 577833.185287 600363.857043 623023.102601 6.458045e+05 6.444986e+05 6.670286e+05 6.896879e+05 7.124692e+05 7.111633e+05 7.336934e+05 7.563526e+05 7.791340e+05 7.778281e+05 8.003581e+05 8.230174e+05 8.713253e+05 8.686947e+05 8.916974e+05 9.147987e+05 9.379900e+05 9.353594e+05 9.583622e+05 9.814635e+05 1.004655e+06 1.002024e+06
86343 91454.193554 94682.526922 97183.095405 98956.171309 102173.960151 105402.293517 107902.861999 109675.937901 112893.726742 116122.060107 118622.628589 1.203957e+05 1.236135e+05 1.268418e+05 1.293424e+05 1.311155e+05 1.343333e+05 1.375616e+05 1.400622e+05 1.418352e+05 1.450530e+05 1.482814e+05 1.507819e+05 1.417013e+05 1.536021e+05 1.539259e+05 1.535305e+05 1.524210e+05 1.643219e+05 1.646457e+05 1.642503e+05 1.631408e+05 1.750416e+05

13915 rows × 33 columns

In [0]:
df_t['RegionName'] = df_t['RegionName'].astype(int)
In [0]:
new_df = pd.merge(df_t, og_df, on="RegionName", how="left")
In [51]:
new_df
Out[51]:
RegionName 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 RegionID City State Metro CountyName SizeRank ... 2016-09 2016-10 2016-11 2016-12 2017-01 2017-02 2017-03 2017-04 2017-05 2017-06 2017-07 2017-08 2017-09 2017-10 2017-11 2017-12 2018-01 2018-02 2018-03 2018-04 2018-05 2018-06 2018-07 2018-08 2018-09 2018-10 2018-11 2018-12 2019-01 2019-02 2019-03 2019-04 2019-05 2019-06 2019-07 2019-08 2019-09 2019-10 2019-11 2019-12
0 60657 471939.146986 496487.087257 522374.359072 549597.800846 564426.006323 588973.946599 614861.218411 642080.732846 656903.847279 681444.165086 707317.035488 7.345223e+05 7.493324e+05 7.738621e+05 7.997312e+05 8.269365e+05 8.417464e+05 8.662762e+05 8.921453e+05 9.193505e+05 9.341605e+05 9.586903e+05 9.845594e+05 1.041382e+06 1.040300e+06 1.070158e+06 1.101328e+06 1.133797e+06 1.132714e+06 1.162573e+06 1.193742e+06 1.226211e+06 1.225129e+06 84654 Chicago IL Chicago-Naperville-Elgin Cook County 2 ... 926166.0 926066.0 929987.0 931155.0 933542.0 935872.0 945765.0 950893.0 950923.0 945971.0 940106.0 937789.0 937761.0 935120.0 931248 932154 941705 953981 959260 960954 959673 959082 954912 950660 948543 948906 951721 954743 957441 961651 966123 967557 965155 960225 956709 953095 950684 948136 946838 945928
1 77494 202222.028612 207762.918144 212961.066732 217816.842570 223657.943941 229198.833509 234396.982068 239252.757916 245093.859298 250638.201717 255840.224392 2.607071e+05 2.665659e+05 2.721364e+05 2.773679e+05 2.850586e+05 2.937513e+05 3.021387e+05 3.101834e+05 3.178857e+05 3.265812e+05 3.349686e+05 3.430133e+05 3.452969e+05 3.580764e+05 3.650972e+05 3.717798e+05 3.781268e+05 3.909063e+05 3.979271e+05 4.046097e+05 4.109567e+05 4.237362e+05 91982 Katy TX Houston-The Woodlands-Sugar Land Harris County 4 ... 329476.0 328831.0 328912.0 329142.0 329312.0 330345.0 331281.0 331534.0 330699.0 330184.0 330013.0 329488.0 329015.0 328902.0 329123 330287 331699 332214 332264 332737 333805 334293 333806 333609 333839 334129 334753 334497 335272 335363 335789 335035 334542 334176 334363 334127 334458 334460 334679 334309
2 60614 796920.397585 824024.164447 849791.908981 874214.243009 869097.909573 896201.676216 921969.420977 946391.754876 941275.421352 968379.178964 994146.907946 1.018569e+06 1.013452e+06 1.040555e+06 1.066322e+06 1.090743e+06 1.085626e+06 1.112729e+06 1.138496e+06 1.162917e+06 1.157800e+06 1.184903e+06 1.210669e+06 1.247033e+06 1.258160e+06 1.279870e+06 1.300220e+06 1.319207e+06 1.330333e+06 1.352044e+06 1.372393e+06 1.391380e+06 1.402507e+06 84616 Chicago IL Chicago-Naperville-Elgin Cook County 5 ... 1141840.0 1140892.0 1144867.0 1147812.0 1153703.0 1159757.0 1174693.0 1185995.0 1191061.0 1187382.0 1179120.0 1174446.0 1174467.0 1173676.0 1172203 1176623 1186741 1197817 1201566 1204015 1204371 1201598 1195307 1189358 1186838 1185950 1187917 1190385 1191138 1193324 1198898 1203423 1204840 1199747 1194591 1188702 1183500 1179024 1175407 1174008
3 77449 91824.749488 95747.158288 98706.117626 100701.913820 104819.786172 108742.194970 111701.154312 113696.950513 117814.822871 121737.231672 124696.191015 1.266926e+05 1.308134e+05 1.347436e+05 1.377112e+05 1.397210e+05 1.438554e+05 1.477966e+05 1.507758e+05 1.527918e+05 1.569300e+05 1.608726e+05 1.638518e+05 1.512876e+05 1.669226e+05 1.670198e+05 1.661645e+05 1.643636e+05 1.799987e+05 1.800958e+05 1.792405e+05 1.774397e+05 1.930747e+05 91940 Katy TX Houston-The Woodlands-Sugar Land Harris County 6 ... 165953.0 165940.0 166732.0 167576.0 168021.0 168313.0 168786.0 169533.0 169947.0 170295.0 170306.0 170515.0 170809.0 171490.0 172012 172450 172949 173412 174031 175131 176228 177072 177465 178115 178774 179453 179904 180418 181290 181995 182559 182569 182940 183549 184481 185254 185518 186051 187010 187930
4 77084 91459.742472 95429.981924 98406.642481 100389.968950 104448.220793 108418.460261 111395.120826 113378.447305 117437.724067 121408.985719 124386.668479 1.263710e+05 1.304339e+05 1.344147e+05 1.374060e+05 1.394107e+05 1.434962e+05 1.474937e+05 1.504996e+05 1.525123e+05 1.565999e+05 1.605995e+05 1.636055e+05 1.506939e+05 1.666394e+05 1.666729e+05 1.657240e+05 1.637997e+05 1.797452e+05 1.797787e+05 1.788298e+05 1.769055e+05 1.928510e+05 91733 Houston TX Houston-The Woodlands-Sugar Land Harris County 8 ... 162716.0 162580.0 163419.0 164403.0 164907.0 165349.0 165907.0 166788.0 167307.0 167773.0 167875.0 168002.0 168128.0 168474.0 168793 168958 169280 169682 170375 171702 173079 174161 174860 175710 176572 177375 177998 178631 179539 180236 180757 180839 181191 181836 182590 183239 183408 184045 184837 185617
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
13910 47986 66037.989375 66339.088058 66628.620749 66905.727509 64451.358133 64752.456813 65041.989476 65319.096199 62864.709569 63165.685591 63454.504079 6.373083e+04 6.127555e+04 6.157573e+04 6.186435e+04 6.214054e+04 5.968526e+04 5.998544e+04 6.027406e+04 6.055025e+04 5.809497e+04 5.839515e+04 5.868377e+04 6.151348e+04 5.922287e+04 5.947162e+04 5.970535e+04 5.992320e+04 5.763258e+04 5.788133e+04 5.811506e+04 5.833291e+04 5.604229e+04 78883 Oxford IN Lafayette-West Lafayette Benton County 30383 ... 56253.0 56093.0 55167.0 54256.0 53854.0 54025.0 54160.0 54376.0 54282.0 54237.0 54842.0 55061.0 55166.0 55054.0 55362 55204 55192 55402 55810 56980 57107 58199 58360 59118 59511 60555 61862 62540 62753 62798 63227 63885 64907 65864 65798 65606 65327 65812 66459 66003
13911 89155 250691.446764 255028.623188 258459.285007 260983.330300 264084.518904 268421.695325 271852.357148 274376.402445 277477.591049 281814.767023 285245.428393 2.877695e+05 2.908707e+05 2.952078e+05 2.986385e+05 3.011625e+05 3.042637e+05 3.086009e+05 3.120316e+05 3.145556e+05 3.176568e+05 3.219940e+05 3.254246e+05 3.156357e+05 3.295675e+05 3.302840e+05 3.301024e+05 3.290288e+05 3.429606e+05 3.436770e+05 3.434955e+05 3.424218e+05 3.563536e+05 95851 Las Vegas NV Las Vegas-Henderson-Paradise Clark County 30386 ... 308128.0 307701.0 308713.0 306061.0 306130.0 306704.0 311002.0 313877.0 316316.0 320577.0 325170.0 328515.0 331595.0 335796.0 341168 345463 348375 352607 353869 355394 355965 359950 363843 367509 369608 370912 371608 373182 374463 376432 376454 377298 377540 377759 376302 374252 372875 373871 377652 381297
13912 55144 76857.478471 82633.187309 87967.752763 92860.388688 95856.195633 101631.904482 106966.469947 111859.105861 114854.912788 120630.621620 125965.187071 1.308578e+05 1.338536e+05 1.396293e+05 1.449639e+05 1.498565e+05 1.528523e+05 1.586281e+05 1.639626e+05 1.688553e+05 1.718511e+05 1.776268e+05 1.829613e+05 1.840168e+05 1.923046e+05 1.963140e+05 1.998836e+05 2.030155e+05 2.113034e+05 2.153127e+05 2.188823e+05 2.220142e+05 2.303021e+05 82132 North Saint Paul MN Minneapolis-St. Paul-Bloomington Ramsey County 30394 ... 173187.0 175760.0 177509.0 177564.0 178435.0 179381.0 180957.0 182640.0 184693.0 187146.0 188633.0 188982.0 187779.0 187085.0 186458 187445 187328 188565 190869 194636 196252 195963 195094 194027 192301 190185 190655 191777 194809 196492 199233 200192 202521 203196 205309 207089 210780 212704 214513 215048
13913 4033 444447.599617 466985.532392 489652.665437 512441.900874 511143.936786 533681.869435 556349.002322 579134.788063 577833.185287 600363.857043 623023.102601 6.458045e+05 6.444986e+05 6.670286e+05 6.896879e+05 7.124692e+05 7.111633e+05 7.336934e+05 7.563526e+05 7.791340e+05 7.778281e+05 8.003581e+05 8.230174e+05 8.713253e+05 8.686947e+05 8.916974e+05 9.147987e+05 9.379900e+05 9.353594e+05 9.583622e+05 9.814635e+05 1.004655e+06 1.002024e+06 59316 Cumberland ME Portland-South Portland Cumberland County 30406 ... 754909.0 758036.0 761435.0 768094.0 766578.0 762320.0 752773.0 748461.0 747821.0 757038.0 763469.0 769171.0 767781.0 768697.0 765186 762276 767842 782234 798384 809019 816325 822235 828279 835550 836361 828778 819612 816921 815432 818015 817141 821568 822967 827644 829819 829813 831954 834711 835468 835442
13914 86343 91454.193554 94682.526922 97183.095405 98956.171309 102173.960151 105402.293517 107902.861999 109675.937901 112893.726742 116122.060107 118622.628589 1.203957e+05 1.236135e+05 1.268418e+05 1.293424e+05 1.311155e+05 1.343333e+05 1.375616e+05 1.400622e+05 1.418352e+05 1.450530e+05 1.482814e+05 1.507819e+05 1.417013e+05 1.536021e+05 1.539259e+05 1.535305e+05 1.524210e+05 1.643219e+05 1.646457e+05 1.642503e+05 1.631408e+05 1.750416e+05 95186 Crown King AZ Prescott Yavapai County 30409 ... 148504.0 148728.0 148675.0 148071.0 148040.0 148237.0 150278.0 152458.0 154095.0 155395.0 155581.0 156679.0 158061.0 161172.0 163807 164597 164659 164551 164266 164466 164931 165918 164952 163705 161726 161421 160435 161620 161055 163640 162246 161795 159728 161152 162761 163262 163061 162006 162935 163710

13915 rows × 325 columns

In [0]:
new_df.to_csv('zips_merged.csv')
In [0]:
from google.colab import files
files.download('zips_merged.csv')
In [55]:
list(new_df.columns)
Out[55]:
['RegionName',
 1997,
 1998,
 1999,
 2000,
 2001,
 2002,
 2003,
 2004,
 2005,
 2006,
 2007,
 2008,
 2009,
 2010,
 2011,
 2012,
 2013,
 2014,
 2015,
 2016,
 2017,
 2018,
 2019,
 2020,
 2021,
 2022,
 2023,
 2024,
 2025,
 2026,
 2027,
 2028,
 2029,
 'RegionID',
 'City',
 'State',
 'Metro',
 'CountyName',
 'SizeRank',
 '1996-04',
 '1996-05',
 '1996-06',
 '1996-07',
 '1996-08',
 '1996-09',
 '1996-10',
 '1996-11',
 '1996-12',
 '1997-01',
 '1997-02',
 '1997-03',
 '1997-04',
 '1997-05',
 '1997-06',
 '1997-07',
 '1997-08',
 '1997-09',
 '1997-10',
 '1997-11',
 '1997-12',
 '1998-01',
 '1998-02',
 '1998-03',
 '1998-04',
 '1998-05',
 '1998-06',
 '1998-07',
 '1998-08',
 '1998-09',
 '1998-10',
 '1998-11',
 '1998-12',
 '1999-01',
 '1999-02',
 '1999-03',
 '1999-04',
 '1999-05',
 '1999-06',
 '1999-07',
 '1999-08',
 '1999-09',
 '1999-10',
 '1999-11',
 '1999-12',
 '2000-01',
 '2000-02',
 '2000-03',
 '2000-04',
 '2000-05',
 '2000-06',
 '2000-07',
 '2000-08',
 '2000-09',
 '2000-10',
 '2000-11',
 '2000-12',
 '2001-01',
 '2001-02',
 '2001-03',
 '2001-04',
 '2001-05',
 '2001-06',
 '2001-07',
 '2001-08',
 '2001-09',
 '2001-10',
 '2001-11',
 '2001-12',
 '2002-01',
 '2002-02',
 '2002-03',
 '2002-04',
 '2002-05',
 '2002-06',
 '2002-07',
 '2002-08',
 '2002-09',
 '2002-10',
 '2002-11',
 '2002-12',
 '2003-01',
 '2003-02',
 '2003-03',
 '2003-04',
 '2003-05',
 '2003-06',
 '2003-07',
 '2003-08',
 '2003-09',
 '2003-10',
 '2003-11',
 '2003-12',
 '2004-01',
 '2004-02',
 '2004-03',
 '2004-04',
 '2004-05',
 '2004-06',
 '2004-07',
 '2004-08',
 '2004-09',
 '2004-10',
 '2004-11',
 '2004-12',
 '2005-01',
 '2005-02',
 '2005-03',
 '2005-04',
 '2005-05',
 '2005-06',
 '2005-07',
 '2005-08',
 '2005-09',
 '2005-10',
 '2005-11',
 '2005-12',
 '2006-01',
 '2006-02',
 '2006-03',
 '2006-04',
 '2006-05',
 '2006-06',
 '2006-07',
 '2006-08',
 '2006-09',
 '2006-10',
 '2006-11',
 '2006-12',
 '2007-01',
 '2007-02',
 '2007-03',
 '2007-04',
 '2007-05',
 '2007-06',
 '2007-07',
 '2007-08',
 '2007-09',
 '2007-10',
 '2007-11',
 '2007-12',
 '2008-01',
 '2008-02',
 '2008-03',
 '2008-04',
 '2008-05',
 '2008-06',
 '2008-07',
 '2008-08',
 '2008-09',
 '2008-10',
 '2008-11',
 '2008-12',
 '2009-01',
 '2009-02',
 '2009-03',
 '2009-04',
 '2009-05',
 '2009-06',
 '2009-07',
 '2009-08',
 '2009-09',
 '2009-10',
 '2009-11',
 '2009-12',
 '2010-01',
 '2010-02',
 '2010-03',
 '2010-04',
 '2010-05',
 '2010-06',
 '2010-07',
 '2010-08',
 '2010-09',
 '2010-10',
 '2010-11',
 '2010-12',
 '2011-01',
 '2011-02',
 '2011-03',
 '2011-04',
 '2011-05',
 '2011-06',
 '2011-07',
 '2011-08',
 '2011-09',
 '2011-10',
 '2011-11',
 '2011-12',
 '2012-01',
 '2012-02',
 '2012-03',
 '2012-04',
 '2012-05',
 '2012-06',
 '2012-07',
 '2012-08',
 '2012-09',
 '2012-10',
 '2012-11',
 '2012-12',
 '2013-01',
 '2013-02',
 '2013-03',
 '2013-04',
 '2013-05',
 '2013-06',
 '2013-07',
 '2013-08',
 '2013-09',
 '2013-10',
 '2013-11',
 '2013-12',
 '2014-01',
 '2014-02',
 '2014-03',
 '2014-04',
 '2014-05',
 '2014-06',
 '2014-07',
 '2014-08',
 '2014-09',
 '2014-10',
 '2014-11',
 '2014-12',
 '2015-01',
 '2015-02',
 '2015-03',
 '2015-04',
 '2015-05',
 '2015-06',
 '2015-07',
 '2015-08',
 '2015-09',
 '2015-10',
 '2015-11',
 '2015-12',
 '2016-01',
 '2016-02',
 '2016-03',
 '2016-04',
 '2016-05',
 '2016-06',
 '2016-07',
 '2016-08',
 '2016-09',
 '2016-10',
 '2016-11',
 '2016-12',
 '2017-01',
 '2017-02',
 '2017-03',
 '2017-04',
 '2017-05',
 '2017-06',
 '2017-07',
 '2017-08',
 '2017-09',
 '2017-10',
 '2017-11',
 '2017-12',
 '2018-01',
 '2018-02',
 '2018-03',
 '2018-04',
 '2018-05',
 '2018-06',
 '2018-07',
 '2018-08',
 '2018-09',
 '2018-10',
 '2018-11',
 '2018-12',
 '2019-01',
 '2019-02',
 '2019-03',
 '2019-04',
 '2019-05',
 '2019-06',
 '2019-07',
 '2019-08',
 '2019-09',
 '2019-10',
 '2019-11',
 '2019-12']
In [0]:
columns = ['RegionName','RegionID',
 'City',
 'State',
 'Metro',
 'CountyName',
 'SizeRank',
  1997,
 1998,
 1999,
 2000,
 2001,
 2002,
 2003,
 2004,
 2005,
 2006,
 2007,
 2008,
 2009,
 2010,
 2011,
 2012,
 2013,
 2014,
 2015,
 2016,
 2017,
 2018,
 2019,
 2020,
 2021,
 2022,
 2023,
 2024,
 2025,
 2026,
 2027,
 2028,
 2029,
 '1996-04',
 '1996-05',
 '1996-06',
 '1996-07',
 '1996-08',
 '1996-09',
 '1996-10',
 '1996-11',
 '1996-12',
 '1997-01',
 '1997-02',
 '1997-03',
 '1997-04',
 '1997-05',
 '1997-06',
 '1997-07',
 '1997-08',
 '1997-09',
 '1997-10',
 '1997-11',
 '1997-12',
 '1998-01',
 '1998-02',
 '1998-03',
 '1998-04',
 '1998-05',
 '1998-06',
 '1998-07',
 '1998-08',
 '1998-09',
 '1998-10',
 '1998-11',
 '1998-12',
 '1999-01',
 '1999-02',
 '1999-03',
 '1999-04',
 '1999-05',
 '1999-06',
 '1999-07',
 '1999-08',
 '1999-09',
 '1999-10',
 '1999-11',
 '1999-12',
 '2000-01',
 '2000-02',
 '2000-03',
 '2000-04',
 '2000-05',
 '2000-06',
 '2000-07',
 '2000-08',
 '2000-09',
 '2000-10',
 '2000-11',
 '2000-12',
 '2001-01',
 '2001-02',
 '2001-03',
 '2001-04',
 '2001-05',
 '2001-06',
 '2001-07',
 '2001-08',
 '2001-09',
 '2001-10',
 '2001-11',
 '2001-12',
 '2002-01',
 '2002-02',
 '2002-03',
 '2002-04',
 '2002-05',
 '2002-06',
 '2002-07',
 '2002-08',
 '2002-09',
 '2002-10',
 '2002-11',
 '2002-12',
 '2003-01',
 '2003-02',
 '2003-03',
 '2003-04',
 '2003-05',
 '2003-06',
 '2003-07',
 '2003-08',
 '2003-09',
 '2003-10',
 '2003-11',
 '2003-12',
 '2004-01',
 '2004-02',
 '2004-03',
 '2004-04',
 '2004-05',
 '2004-06',
 '2004-07',
 '2004-08',
 '2004-09',
 '2004-10',
 '2004-11',
 '2004-12',
 '2005-01',
 '2005-02',
 '2005-03',
 '2005-04',
 '2005-05',
 '2005-06',
 '2005-07',
 '2005-08',
 '2005-09',
 '2005-10',
 '2005-11',
 '2005-12',
 '2006-01',
 '2006-02',
 '2006-03',
 '2006-04',
 '2006-05',
 '2006-06',
 '2006-07',
 '2006-08',
 '2006-09',
 '2006-10',
 '2006-11',
 '2006-12',
 '2007-01',
 '2007-02',
 '2007-03',
 '2007-04',
 '2007-05',
 '2007-06',
 '2007-07',
 '2007-08',
 '2007-09',
 '2007-10',
 '2007-11',
 '2007-12',
 '2008-01',
 '2008-02',
 '2008-03',
 '2008-04',
 '2008-05',
 '2008-06',
 '2008-07',
 '2008-08',
 '2008-09',
 '2008-10',
 '2008-11',
 '2008-12',
 '2009-01',
 '2009-02',
 '2009-03',
 '2009-04',
 '2009-05',
 '2009-06',
 '2009-07',
 '2009-08',
 '2009-09',
 '2009-10',
 '2009-11',
 '2009-12',
 '2010-01',
 '2010-02',
 '2010-03',
 '2010-04',
 '2010-05',
 '2010-06',
 '2010-07',
 '2010-08',
 '2010-09',
 '2010-10',
 '2010-11',
 '2010-12',
 '2011-01',
 '2011-02',
 '2011-03',
 '2011-04',
 '2011-05',
 '2011-06',
 '2011-07',
 '2011-08',
 '2011-09',
 '2011-10',
 '2011-11',
 '2011-12',
 '2012-01',
 '2012-02',
 '2012-03',
 '2012-04',
 '2012-05',
 '2012-06',
 '2012-07',
 '2012-08',
 '2012-09',
 '2012-10',
 '2012-11',
 '2012-12',
 '2013-01',
 '2013-02',
 '2013-03',
 '2013-04',
 '2013-05',
 '2013-06',
 '2013-07',
 '2013-08',
 '2013-09',
 '2013-10',
 '2013-11',
 '2013-12',
 '2014-01',
 '2014-02',
 '2014-03',
 '2014-04',
 '2014-05',
 '2014-06',
 '2014-07',
 '2014-08',
 '2014-09',
 '2014-10',
 '2014-11',
 '2014-12',
 '2015-01',
 '2015-02',
 '2015-03',
 '2015-04',
 '2015-05',
 '2015-06',
 '2015-07',
 '2015-08',
 '2015-09',
 '2015-10',
 '2015-11',
 '2015-12',
 '2016-01',
 '2016-02',
 '2016-03',
 '2016-04',
 '2016-05',
 '2016-06',
 '2016-07',
 '2016-08',
 '2016-09',
 '2016-10',
 '2016-11',
 '2016-12',
 '2017-01',
 '2017-02',
 '2017-03',
 '2017-04',
 '2017-05',
 '2017-06',
 '2017-07',
 '2017-08',
 '2017-09',
 '2017-10',
 '2017-11',
 '2017-12',
 '2018-01',
 '2018-02',
 '2018-03',
 '2018-04',
 '2018-05',
 '2018-06',
 '2018-07',
 '2018-08',
 '2018-09',
 '2018-10',
 '2018-11',
 '2018-12',
 '2019-01',
 '2019-02',
 '2019-03',
 '2019-04',
 '2019-05',
 '2019-06',
 '2019-07',
 '2019-08',
 '2019-09',
 '2019-10',
 '2019-11',
 '2019-12']
In [0]:
new_df = new_df[columns]
In [60]:
new_df.sort_values(by="SizeRank")
Out[60]:
RegionName RegionID City State Metro CountyName SizeRank 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 ... 2016-09 2016-10 2016-11 2016-12 2017-01 2017-02 2017-03 2017-04 2017-05 2017-06 2017-07 2017-08 2017-09 2017-10 2017-11 2017-12 2018-01 2018-02 2018-03 2018-04 2018-05 2018-06 2018-07 2018-08 2018-09 2018-10 2018-11 2018-12 2019-01 2019-02 2019-03 2019-04 2019-05 2019-06 2019-07 2019-08 2019-09 2019-10 2019-11 2019-12
0 60657 84654 Chicago IL Chicago-Naperville-Elgin Cook County 2 471939.146986 496487.087257 522374.359072 549597.800846 564426.006323 588973.946599 614861.218411 642080.732846 656903.847279 681444.165086 707317.035488 7.345223e+05 7.493324e+05 7.738621e+05 7.997312e+05 8.269365e+05 8.417464e+05 8.662762e+05 8.921453e+05 9.193505e+05 9.341605e+05 9.586903e+05 9.845594e+05 1.041382e+06 1.040300e+06 1.070158e+06 1.101328e+06 1.133797e+06 1.132714e+06 1.162573e+06 1.193742e+06 1.226211e+06 1.225129e+06 ... 926166.0 926066.0 929987.0 931155.0 933542.0 935872.0 945765.0 950893.0 950923.0 945971.0 940106.0 937789.0 937761.0 935120.0 931248 932154 941705 953981 959260 960954 959673 959082 954912 950660 948543 948906 951721 954743 957441 961651 966123 967557 965155 960225 956709 953095 950684 948136 946838 945928
1 77494 91982 Katy TX Houston-The Woodlands-Sugar Land Harris County 4 202222.028612 207762.918144 212961.066732 217816.842570 223657.943941 229198.833509 234396.982068 239252.757916 245093.859298 250638.201717 255840.224392 2.607071e+05 2.665659e+05 2.721364e+05 2.773679e+05 2.850586e+05 2.937513e+05 3.021387e+05 3.101834e+05 3.178857e+05 3.265812e+05 3.349686e+05 3.430133e+05 3.452969e+05 3.580764e+05 3.650972e+05 3.717798e+05 3.781268e+05 3.909063e+05 3.979271e+05 4.046097e+05 4.109567e+05 4.237362e+05 ... 329476.0 328831.0 328912.0 329142.0 329312.0 330345.0 331281.0 331534.0 330699.0 330184.0 330013.0 329488.0 329015.0 328902.0 329123 330287 331699 332214 332264 332737 333805 334293 333806 333609 333839 334129 334753 334497 335272 335363 335789 335035 334542 334176 334363 334127 334458 334460 334679 334309
2 60614 84616 Chicago IL Chicago-Naperville-Elgin Cook County 5 796920.397585 824024.164447 849791.908981 874214.243009 869097.909573 896201.676216 921969.420977 946391.754876 941275.421352 968379.178964 994146.907946 1.018569e+06 1.013452e+06 1.040555e+06 1.066322e+06 1.090743e+06 1.085626e+06 1.112729e+06 1.138496e+06 1.162917e+06 1.157800e+06 1.184903e+06 1.210669e+06 1.247033e+06 1.258160e+06 1.279870e+06 1.300220e+06 1.319207e+06 1.330333e+06 1.352044e+06 1.372393e+06 1.391380e+06 1.402507e+06 ... 1141840.0 1140892.0 1144867.0 1147812.0 1153703.0 1159757.0 1174693.0 1185995.0 1191061.0 1187382.0 1179120.0 1174446.0 1174467.0 1173676.0 1172203 1176623 1186741 1197817 1201566 1204015 1204371 1201598 1195307 1189358 1186838 1185950 1187917 1190385 1191138 1193324 1198898 1203423 1204840 1199747 1194591 1188702 1183500 1179024 1175407 1174008
3 77449 91940 Katy TX Houston-The Woodlands-Sugar Land Harris County 6 91824.749488 95747.158288 98706.117626 100701.913820 104819.786172 108742.194970 111701.154312 113696.950513 117814.822871 121737.231672 124696.191015 1.266926e+05 1.308134e+05 1.347436e+05 1.377112e+05 1.397210e+05 1.438554e+05 1.477966e+05 1.507758e+05 1.527918e+05 1.569300e+05 1.608726e+05 1.638518e+05 1.512876e+05 1.669226e+05 1.670198e+05 1.661645e+05 1.643636e+05 1.799987e+05 1.800958e+05 1.792405e+05 1.774397e+05 1.930747e+05 ... 165953.0 165940.0 166732.0 167576.0 168021.0 168313.0 168786.0 169533.0 169947.0 170295.0 170306.0 170515.0 170809.0 171490.0 172012 172450 172949 173412 174031 175131 176228 177072 177465 178115 178774 179453 179904 180418 181290 181995 182559 182569 182940 183549 184481 185254 185518 186051 187010 187930
4 77084 91733 Houston TX Houston-The Woodlands-Sugar Land Harris County 8 91459.742472 95429.981924 98406.642481 100389.968950 104448.220793 108418.460261 111395.120826 113378.447305 117437.724067 121408.985719 124386.668479 1.263710e+05 1.304339e+05 1.344147e+05 1.374060e+05 1.394107e+05 1.434962e+05 1.474937e+05 1.504996e+05 1.525123e+05 1.565999e+05 1.605995e+05 1.636055e+05 1.506939e+05 1.666394e+05 1.666729e+05 1.657240e+05 1.637997e+05 1.797452e+05 1.797787e+05 1.788298e+05 1.769055e+05 1.928510e+05 ... 162716.0 162580.0 163419.0 164403.0 164907.0 165349.0 165907.0 166788.0 167307.0 167773.0 167875.0 168002.0 168128.0 168474.0 168793 168958 169280 169682 170375 171702 173079 174161 174860 175710 176572 177375 177998 178631 179539 180236 180757 180839 181191 181836 182590 183239 183408 184045 184837 185617
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
13910 47986 78883 Oxford IN Lafayette-West Lafayette Benton County 30383 66037.989375 66339.088058 66628.620749 66905.727509 64451.358133 64752.456813 65041.989476 65319.096199 62864.709569 63165.685591 63454.504079 6.373083e+04 6.127555e+04 6.157573e+04 6.186435e+04 6.214054e+04 5.968526e+04 5.998544e+04 6.027406e+04 6.055025e+04 5.809497e+04 5.839515e+04 5.868377e+04 6.151348e+04 5.922287e+04 5.947162e+04 5.970535e+04 5.992320e+04 5.763258e+04 5.788133e+04 5.811506e+04 5.833291e+04 5.604229e+04 ... 56253.0 56093.0 55167.0 54256.0 53854.0 54025.0 54160.0 54376.0 54282.0 54237.0 54842.0 55061.0 55166.0 55054.0 55362 55204 55192 55402 55810 56980 57107 58199 58360 59118 59511 60555 61862 62540 62753 62798 63227 63885 64907 65864 65798 65606 65327 65812 66459 66003
13911 89155 95851 Las Vegas NV Las Vegas-Henderson-Paradise Clark County 30386 250691.446764 255028.623188 258459.285007 260983.330300 264084.518904 268421.695325 271852.357148 274376.402445 277477.591049 281814.767023 285245.428393 2.877695e+05 2.908707e+05 2.952078e+05 2.986385e+05 3.011625e+05 3.042637e+05 3.086009e+05 3.120316e+05 3.145556e+05 3.176568e+05 3.219940e+05 3.254246e+05 3.156357e+05 3.295675e+05 3.302840e+05 3.301024e+05 3.290288e+05 3.429606e+05 3.436770e+05 3.434955e+05 3.424218e+05 3.563536e+05 ... 308128.0 307701.0 308713.0 306061.0 306130.0 306704.0 311002.0 313877.0 316316.0 320577.0 325170.0 328515.0 331595.0 335796.0 341168 345463 348375 352607 353869 355394 355965 359950 363843 367509 369608 370912 371608 373182 374463 376432 376454 377298 377540 377759 376302 374252 372875 373871 377652 381297
13912 55144 82132 North Saint Paul MN Minneapolis-St. Paul-Bloomington Ramsey County 30394 76857.478471 82633.187309 87967.752763 92860.388688 95856.195633 101631.904482 106966.469947 111859.105861 114854.912788 120630.621620 125965.187071 1.308578e+05 1.338536e+05 1.396293e+05 1.449639e+05 1.498565e+05 1.528523e+05 1.586281e+05 1.639626e+05 1.688553e+05 1.718511e+05 1.776268e+05 1.829613e+05 1.840168e+05 1.923046e+05 1.963140e+05 1.998836e+05 2.030155e+05 2.113034e+05 2.153127e+05 2.188823e+05 2.220142e+05 2.303021e+05 ... 173187.0 175760.0 177509.0 177564.0 178435.0 179381.0 180957.0 182640.0 184693.0 187146.0 188633.0 188982.0 187779.0 187085.0 186458 187445 187328 188565 190869 194636 196252 195963 195094 194027 192301 190185 190655 191777 194809 196492 199233 200192 202521 203196 205309 207089 210780 212704 214513 215048
13913 4033 59316 Cumberland ME Portland-South Portland Cumberland County 30406 444447.599617 466985.532392 489652.665437 512441.900874 511143.936786 533681.869435 556349.002322 579134.788063 577833.185287 600363.857043 623023.102601 6.458045e+05 6.444986e+05 6.670286e+05 6.896879e+05 7.124692e+05 7.111633e+05 7.336934e+05 7.563526e+05 7.791340e+05 7.778281e+05 8.003581e+05 8.230174e+05 8.713253e+05 8.686947e+05 8.916974e+05 9.147987e+05 9.379900e+05 9.353594e+05 9.583622e+05 9.814635e+05 1.004655e+06 1.002024e+06 ... 754909.0 758036.0 761435.0 768094.0 766578.0 762320.0 752773.0 748461.0 747821.0 757038.0 763469.0 769171.0 767781.0 768697.0 765186 762276 767842 782234 798384 809019 816325 822235 828279 835550 836361 828778 819612 816921 815432 818015 817141 821568 822967 827644 829819 829813 831954 834711 835468 835442
13914 86343 95186 Crown King AZ Prescott Yavapai County 30409 91454.193554 94682.526922 97183.095405 98956.171309 102173.960151 105402.293517 107902.861999 109675.937901 112893.726742 116122.060107 118622.628589 1.203957e+05 1.236135e+05 1.268418e+05 1.293424e+05 1.311155e+05 1.343333e+05 1.375616e+05 1.400622e+05 1.418352e+05 1.450530e+05 1.482814e+05 1.507819e+05 1.417013e+05 1.536021e+05 1.539259e+05 1.535305e+05 1.524210e+05 1.643219e+05 1.646457e+05 1.642503e+05 1.631408e+05 1.750416e+05 ... 148504.0 148728.0 148675.0 148071.0 148040.0 148237.0 150278.0 152458.0 154095.0 155395.0 155581.0 156679.0 158061.0 161172.0 163807 164597 164659 164551 164266 164466 164931 165918 164952 163705 161726 161421 160435 161620 161055 163640 162246 161795 159728 161152 162761 163262 163061 162006 162935 163710

13915 rows × 325 columns

In [0]:
columns2 = ['RegionName',
'RegionID',
 'City',
 'State',
 'Metro',
 'CountyName',
 'SizeRank',
 1997,
 1998,
 1999,
 2000,
 2001,
 2002,
 2003,
 2004,
 2005,
 2006,
 2007,
 2008,
 2009,
 2010,
 2011,
 2012,
 2013,
 2014,
 2015,
 2016,
 2017,
 2018,
 2019,
 2020,
 2021,
 2022,
 2023,
 2024,
 2025,
 2026,
 2027,
 2028,
 2029]
In [0]:
new_df_sm = new_df[columns2]
In [68]:
new_df_sm
Out[68]:
RegionName RegionID City State Metro CountyName SizeRank 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029
0 60657 84654 Chicago IL Chicago-Naperville-Elgin Cook County 2 471939.146986 496487.087257 522374.359072 549597.800846 564426.006323 588973.946599 614861.218411 642080.732846 656903.847279 681444.165086 707317.035488 7.345223e+05 7.493324e+05 7.738621e+05 7.997312e+05 8.269365e+05 8.417464e+05 8.662762e+05 8.921453e+05 9.193505e+05 9.341605e+05 9.586903e+05 9.845594e+05 1.041382e+06 1.040300e+06 1.070158e+06 1.101328e+06 1.133797e+06 1.132714e+06 1.162573e+06 1.193742e+06 1.226211e+06 1.225129e+06
1 77494 91982 Katy TX Houston-The Woodlands-Sugar Land Harris County 4 202222.028612 207762.918144 212961.066732 217816.842570 223657.943941 229198.833509 234396.982068 239252.757916 245093.859298 250638.201717 255840.224392 2.607071e+05 2.665659e+05 2.721364e+05 2.773679e+05 2.850586e+05 2.937513e+05 3.021387e+05 3.101834e+05 3.178857e+05 3.265812e+05 3.349686e+05 3.430133e+05 3.452969e+05 3.580764e+05 3.650972e+05 3.717798e+05 3.781268e+05 3.909063e+05 3.979271e+05 4.046097e+05 4.109567e+05 4.237362e+05
2 60614 84616 Chicago IL Chicago-Naperville-Elgin Cook County 5 796920.397585 824024.164447 849791.908981 874214.243009 869097.909573 896201.676216 921969.420977 946391.754876 941275.421352 968379.178964 994146.907946 1.018569e+06 1.013452e+06 1.040555e+06 1.066322e+06 1.090743e+06 1.085626e+06 1.112729e+06 1.138496e+06 1.162917e+06 1.157800e+06 1.184903e+06 1.210669e+06 1.247033e+06 1.258160e+06 1.279870e+06 1.300220e+06 1.319207e+06 1.330333e+06 1.352044e+06 1.372393e+06 1.391380e+06 1.402507e+06
3 77449 91940 Katy TX Houston-The Woodlands-Sugar Land Harris County 6 91824.749488 95747.158288 98706.117626 100701.913820 104819.786172 108742.194970 111701.154312 113696.950513 117814.822871 121737.231672 124696.191015 1.266926e+05 1.308134e+05 1.347436e+05 1.377112e+05 1.397210e+05 1.438554e+05 1.477966e+05 1.507758e+05 1.527918e+05 1.569300e+05 1.608726e+05 1.638518e+05 1.512876e+05 1.669226e+05 1.670198e+05 1.661645e+05 1.643636e+05 1.799987e+05 1.800958e+05 1.792405e+05 1.774397e+05 1.930747e+05
4 77084 91733 Houston TX Houston-The Woodlands-Sugar Land Harris County 8 91459.742472 95429.981924 98406.642481 100389.968950 104448.220793 108418.460261 111395.120826 113378.447305 117437.724067 121408.985719 124386.668479 1.263710e+05 1.304339e+05 1.344147e+05 1.374060e+05 1.394107e+05 1.434962e+05 1.474937e+05 1.504996e+05 1.525123e+05 1.565999e+05 1.605995e+05 1.636055e+05 1.506939e+05 1.666394e+05 1.666729e+05 1.657240e+05 1.637997e+05 1.797452e+05 1.797787e+05 1.788298e+05 1.769055e+05 1.928510e+05
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
13910 47986 78883 Oxford IN Lafayette-West Lafayette Benton County 30383 66037.989375 66339.088058 66628.620749 66905.727509 64451.358133 64752.456813 65041.989476 65319.096199 62864.709569 63165.685591 63454.504079 6.373083e+04 6.127555e+04 6.157573e+04 6.186435e+04 6.214054e+04 5.968526e+04 5.998544e+04 6.027406e+04 6.055025e+04 5.809497e+04 5.839515e+04 5.868377e+04 6.151348e+04 5.922287e+04 5.947162e+04 5.970535e+04 5.992320e+04 5.763258e+04 5.788133e+04 5.811506e+04 5.833291e+04 5.604229e+04
13911 89155 95851 Las Vegas NV Las Vegas-Henderson-Paradise Clark County 30386 250691.446764 255028.623188 258459.285007 260983.330300 264084.518904 268421.695325 271852.357148 274376.402445 277477.591049 281814.767023 285245.428393 2.877695e+05 2.908707e+05 2.952078e+05 2.986385e+05 3.011625e+05 3.042637e+05 3.086009e+05 3.120316e+05 3.145556e+05 3.176568e+05 3.219940e+05 3.254246e+05 3.156357e+05 3.295675e+05 3.302840e+05 3.301024e+05 3.290288e+05 3.429606e+05 3.436770e+05 3.434955e+05 3.424218e+05 3.563536e+05
13912 55144 82132 North Saint Paul MN Minneapolis-St. Paul-Bloomington Ramsey County 30394 76857.478471 82633.187309 87967.752763 92860.388688 95856.195633 101631.904482 106966.469947 111859.105861 114854.912788 120630.621620 125965.187071 1.308578e+05 1.338536e+05 1.396293e+05 1.449639e+05 1.498565e+05 1.528523e+05 1.586281e+05 1.639626e+05 1.688553e+05 1.718511e+05 1.776268e+05 1.829613e+05 1.840168e+05 1.923046e+05 1.963140e+05 1.998836e+05 2.030155e+05 2.113034e+05 2.153127e+05 2.188823e+05 2.220142e+05 2.303021e+05
13913 4033 59316 Cumberland ME Portland-South Portland Cumberland County 30406 444447.599617 466985.532392 489652.665437 512441.900874 511143.936786 533681.869435 556349.002322 579134.788063 577833.185287 600363.857043 623023.102601 6.458045e+05 6.444986e+05 6.670286e+05 6.896879e+05 7.124692e+05 7.111633e+05 7.336934e+05 7.563526e+05 7.791340e+05 7.778281e+05 8.003581e+05 8.230174e+05 8.713253e+05 8.686947e+05 8.916974e+05 9.147987e+05 9.379900e+05 9.353594e+05 9.583622e+05 9.814635e+05 1.004655e+06 1.002024e+06
13914 86343 95186 Crown King AZ Prescott Yavapai County 30409 91454.193554 94682.526922 97183.095405 98956.171309 102173.960151 105402.293517 107902.861999 109675.937901 112893.726742 116122.060107 118622.628589 1.203957e+05 1.236135e+05 1.268418e+05 1.293424e+05 1.311155e+05 1.343333e+05 1.375616e+05 1.400622e+05 1.418352e+05 1.450530e+05 1.482814e+05 1.507819e+05 1.417013e+05 1.536021e+05 1.539259e+05 1.535305e+05 1.524210e+05 1.643219e+05 1.646457e+05 1.642503e+05 1.631408e+05 1.750416e+05

13915 rows × 40 columns

In [0]:
new_df_sm.to_csv('zip_predictions_2029.csv')
In [0]:
files.download('zip_predictions_2029.csv')
In [0]:
df = new_df_sm.copy()
In [72]:
df
Out[72]:
RegionName RegionID City State Metro CountyName SizeRank 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029
0 60657 84654 Chicago IL Chicago-Naperville-Elgin Cook County 2 471939.146986 496487.087257 522374.359072 549597.800846 564426.006323 588973.946599 614861.218411 642080.732846 656903.847279 681444.165086 707317.035488 7.345223e+05 7.493324e+05 7.738621e+05 7.997312e+05 8.269365e+05 8.417464e+05 8.662762e+05 8.921453e+05 9.193505e+05 9.341605e+05 9.586903e+05 9.845594e+05 1.041382e+06 1.040300e+06 1.070158e+06 1.101328e+06 1.133797e+06 1.132714e+06 1.162573e+06 1.193742e+06 1.226211e+06 1.225129e+06
1 77494 91982 Katy TX Houston-The Woodlands-Sugar Land Harris County 4 202222.028612 207762.918144 212961.066732 217816.842570 223657.943941 229198.833509 234396.982068 239252.757916 245093.859298 250638.201717 255840.224392 2.607071e+05 2.665659e+05 2.721364e+05 2.773679e+05 2.850586e+05 2.937513e+05 3.021387e+05 3.101834e+05 3.178857e+05 3.265812e+05 3.349686e+05 3.430133e+05 3.452969e+05 3.580764e+05 3.650972e+05 3.717798e+05 3.781268e+05 3.909063e+05 3.979271e+05 4.046097e+05 4.109567e+05 4.237362e+05
2 60614 84616 Chicago IL Chicago-Naperville-Elgin Cook County 5 796920.397585 824024.164447 849791.908981 874214.243009 869097.909573 896201.676216 921969.420977 946391.754876 941275.421352 968379.178964 994146.907946 1.018569e+06 1.013452e+06 1.040555e+06 1.066322e+06 1.090743e+06 1.085626e+06 1.112729e+06 1.138496e+06 1.162917e+06 1.157800e+06 1.184903e+06 1.210669e+06 1.247033e+06 1.258160e+06 1.279870e+06 1.300220e+06 1.319207e+06 1.330333e+06 1.352044e+06 1.372393e+06 1.391380e+06 1.402507e+06
3 77449 91940 Katy TX Houston-The Woodlands-Sugar Land Harris County 6 91824.749488 95747.158288 98706.117626 100701.913820 104819.786172 108742.194970 111701.154312 113696.950513 117814.822871 121737.231672 124696.191015 1.266926e+05 1.308134e+05 1.347436e+05 1.377112e+05 1.397210e+05 1.438554e+05 1.477966e+05 1.507758e+05 1.527918e+05 1.569300e+05 1.608726e+05 1.638518e+05 1.512876e+05 1.669226e+05 1.670198e+05 1.661645e+05 1.643636e+05 1.799987e+05 1.800958e+05 1.792405e+05 1.774397e+05 1.930747e+05
4 77084 91733 Houston TX Houston-The Woodlands-Sugar Land Harris County 8 91459.742472 95429.981924 98406.642481 100389.968950 104448.220793 108418.460261 111395.120826 113378.447305 117437.724067 121408.985719 124386.668479 1.263710e+05 1.304339e+05 1.344147e+05 1.374060e+05 1.394107e+05 1.434962e+05 1.474937e+05 1.504996e+05 1.525123e+05 1.565999e+05 1.605995e+05 1.636055e+05 1.506939e+05 1.666394e+05 1.666729e+05 1.657240e+05 1.637997e+05 1.797452e+05 1.797787e+05 1.788298e+05 1.769055e+05 1.928510e+05
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
13910 47986 78883 Oxford IN Lafayette-West Lafayette Benton County 30383 66037.989375 66339.088058 66628.620749 66905.727509 64451.358133 64752.456813 65041.989476 65319.096199 62864.709569 63165.685591 63454.504079 6.373083e+04 6.127555e+04 6.157573e+04 6.186435e+04 6.214054e+04 5.968526e+04 5.998544e+04 6.027406e+04 6.055025e+04 5.809497e+04 5.839515e+04 5.868377e+04 6.151348e+04 5.922287e+04 5.947162e+04 5.970535e+04 5.992320e+04 5.763258e+04 5.788133e+04 5.811506e+04 5.833291e+04 5.604229e+04
13911 89155 95851 Las Vegas NV Las Vegas-Henderson-Paradise Clark County 30386 250691.446764 255028.623188 258459.285007 260983.330300 264084.518904 268421.695325 271852.357148 274376.402445 277477.591049 281814.767023 285245.428393 2.877695e+05 2.908707e+05 2.952078e+05 2.986385e+05 3.011625e+05 3.042637e+05 3.086009e+05 3.120316e+05 3.145556e+05 3.176568e+05 3.219940e+05 3.254246e+05 3.156357e+05 3.295675e+05 3.302840e+05 3.301024e+05 3.290288e+05 3.429606e+05 3.436770e+05 3.434955e+05 3.424218e+05 3.563536e+05
13912 55144 82132 North Saint Paul MN Minneapolis-St. Paul-Bloomington Ramsey County 30394 76857.478471 82633.187309 87967.752763 92860.388688 95856.195633 101631.904482 106966.469947 111859.105861 114854.912788 120630.621620 125965.187071 1.308578e+05 1.338536e+05 1.396293e+05 1.449639e+05 1.498565e+05 1.528523e+05 1.586281e+05 1.639626e+05 1.688553e+05 1.718511e+05 1.776268e+05 1.829613e+05 1.840168e+05 1.923046e+05 1.963140e+05 1.998836e+05 2.030155e+05 2.113034e+05 2.153127e+05 2.188823e+05 2.220142e+05 2.303021e+05
13913 4033 59316 Cumberland ME Portland-South Portland Cumberland County 30406 444447.599617 466985.532392 489652.665437 512441.900874 511143.936786 533681.869435 556349.002322 579134.788063 577833.185287 600363.857043 623023.102601 6.458045e+05 6.444986e+05 6.670286e+05 6.896879e+05 7.124692e+05 7.111633e+05 7.336934e+05 7.563526e+05 7.791340e+05 7.778281e+05 8.003581e+05 8.230174e+05 8.713253e+05 8.686947e+05 8.916974e+05 9.147987e+05 9.379900e+05 9.353594e+05 9.583622e+05 9.814635e+05 1.004655e+06 1.002024e+06
13914 86343 95186 Crown King AZ Prescott Yavapai County 30409 91454.193554 94682.526922 97183.095405 98956.171309 102173.960151 105402.293517 107902.861999 109675.937901 112893.726742 116122.060107 118622.628589 1.203957e+05 1.236135e+05 1.268418e+05 1.293424e+05 1.311155e+05 1.343333e+05 1.375616e+05 1.400622e+05 1.418352e+05 1.450530e+05 1.482814e+05 1.507819e+05 1.417013e+05 1.536021e+05 1.539259e+05 1.535305e+05 1.524210e+05 1.643219e+05 1.646457e+05 1.642503e+05 1.631408e+05 1.750416e+05

13915 rows × 40 columns

In [0]:
df['roi_28_18'] = df[2028] - df[2018]
In [74]:
df
Out[74]:
RegionName RegionID City State Metro CountyName SizeRank 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 roi_28_18
0 60657 84654 Chicago IL Chicago-Naperville-Elgin Cook County 2 471939.146986 496487.087257 522374.359072 549597.800846 564426.006323 588973.946599 614861.218411 642080.732846 656903.847279 681444.165086 707317.035488 7.345223e+05 7.493324e+05 7.738621e+05 7.997312e+05 8.269365e+05 8.417464e+05 8.662762e+05 8.921453e+05 9.193505e+05 9.341605e+05 9.586903e+05 9.845594e+05 1.041382e+06 1.040300e+06 1.070158e+06 1.101328e+06 1.133797e+06 1.132714e+06 1.162573e+06 1.193742e+06 1.226211e+06 1.225129e+06 267520.326597
1 77494 91982 Katy TX Houston-The Woodlands-Sugar Land Harris County 4 202222.028612 207762.918144 212961.066732 217816.842570 223657.943941 229198.833509 234396.982068 239252.757916 245093.859298 250638.201717 255840.224392 2.607071e+05 2.665659e+05 2.721364e+05 2.773679e+05 2.850586e+05 2.937513e+05 3.021387e+05 3.101834e+05 3.178857e+05 3.265812e+05 3.349686e+05 3.430133e+05 3.452969e+05 3.580764e+05 3.650972e+05 3.717798e+05 3.781268e+05 3.909063e+05 3.979271e+05 4.046097e+05 4.109567e+05 4.237362e+05 75988.073436
2 60614 84616 Chicago IL Chicago-Naperville-Elgin Cook County 5 796920.397585 824024.164447 849791.908981 874214.243009 869097.909573 896201.676216 921969.420977 946391.754876 941275.421352 968379.178964 994146.907946 1.018569e+06 1.013452e+06 1.040555e+06 1.066322e+06 1.090743e+06 1.085626e+06 1.112729e+06 1.138496e+06 1.162917e+06 1.157800e+06 1.184903e+06 1.210669e+06 1.247033e+06 1.258160e+06 1.279870e+06 1.300220e+06 1.319207e+06 1.330333e+06 1.352044e+06 1.372393e+06 1.391380e+06 1.402507e+06 206477.881776
3 77449 91940 Katy TX Houston-The Woodlands-Sugar Land Harris County 6 91824.749488 95747.158288 98706.117626 100701.913820 104819.786172 108742.194970 111701.154312 113696.950513 117814.822871 121737.231672 124696.191015 1.266926e+05 1.308134e+05 1.347436e+05 1.377112e+05 1.397210e+05 1.438554e+05 1.477966e+05 1.507758e+05 1.527918e+05 1.569300e+05 1.608726e+05 1.638518e+05 1.512876e+05 1.669226e+05 1.670198e+05 1.661645e+05 1.643636e+05 1.799987e+05 1.800958e+05 1.792405e+05 1.774397e+05 1.930747e+05 16567.085390
4 77084 91733 Houston TX Houston-The Woodlands-Sugar Land Harris County 8 91459.742472 95429.981924 98406.642481 100389.968950 104448.220793 108418.460261 111395.120826 113378.447305 117437.724067 121408.985719 124386.668479 1.263710e+05 1.304339e+05 1.344147e+05 1.374060e+05 1.394107e+05 1.434962e+05 1.474937e+05 1.504996e+05 1.525123e+05 1.565999e+05 1.605995e+05 1.636055e+05 1.506939e+05 1.666394e+05 1.666729e+05 1.657240e+05 1.637997e+05 1.797452e+05 1.797787e+05 1.788298e+05 1.769055e+05 1.928510e+05 16306.034327
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
13910 47986 78883 Oxford IN Lafayette-West Lafayette Benton County 30383 66037.989375 66339.088058 66628.620749 66905.727509 64451.358133 64752.456813 65041.989476 65319.096199 62864.709569 63165.685591 63454.504079 6.373083e+04 6.127555e+04 6.157573e+04 6.186435e+04 6.214054e+04 5.968526e+04 5.998544e+04 6.027406e+04 6.055025e+04 5.809497e+04 5.839515e+04 5.868377e+04 6.151348e+04 5.922287e+04 5.947162e+04 5.970535e+04 5.992320e+04 5.763258e+04 5.788133e+04 5.811506e+04 5.833291e+04 5.604229e+04 -62.245970
13911 89155 95851 Las Vegas NV Las Vegas-Henderson-Paradise Clark County 30386 250691.446764 255028.623188 258459.285007 260983.330300 264084.518904 268421.695325 271852.357148 274376.402445 277477.591049 281814.767023 285245.428393 2.877695e+05 2.908707e+05 2.952078e+05 2.986385e+05 3.011625e+05 3.042637e+05 3.086009e+05 3.120316e+05 3.145556e+05 3.176568e+05 3.219940e+05 3.254246e+05 3.156357e+05 3.295675e+05 3.302840e+05 3.301024e+05 3.290288e+05 3.429606e+05 3.436770e+05 3.434955e+05 3.424218e+05 3.563536e+05 20427.861348
13912 55144 82132 North Saint Paul MN Minneapolis-St. Paul-Bloomington Ramsey County 30394 76857.478471 82633.187309 87967.752763 92860.388688 95856.195633 101631.904482 106966.469947 111859.105861 114854.912788 120630.621620 125965.187071 1.308578e+05 1.338536e+05 1.396293e+05 1.449639e+05 1.498565e+05 1.528523e+05 1.586281e+05 1.639626e+05 1.688553e+05 1.718511e+05 1.776268e+05 1.829613e+05 1.840168e+05 1.923046e+05 1.963140e+05 1.998836e+05 2.030155e+05 2.113034e+05 2.153127e+05 2.188823e+05 2.220142e+05 2.303021e+05 44387.452046
13913 4033 59316 Cumberland ME Portland-South Portland Cumberland County 30406 444447.599617 466985.532392 489652.665437 512441.900874 511143.936786 533681.869435 556349.002322 579134.788063 577833.185287 600363.857043 623023.102601 6.458045e+05 6.444986e+05 6.670286e+05 6.896879e+05 7.124692e+05 7.111633e+05 7.336934e+05 7.563526e+05 7.791340e+05 7.778281e+05 8.003581e+05 8.230174e+05 8.713253e+05 8.686947e+05 8.916974e+05 9.147987e+05 9.379900e+05 9.353594e+05 9.583622e+05 9.814635e+05 1.004655e+06 1.002024e+06 204296.675464
13914 86343 95186 Crown King AZ Prescott Yavapai County 30409 91454.193554 94682.526922 97183.095405 98956.171309 102173.960151 105402.293517 107902.861999 109675.937901 112893.726742 116122.060107 118622.628589 1.203957e+05 1.236135e+05 1.268418e+05 1.293424e+05 1.311155e+05 1.343333e+05 1.375616e+05 1.400622e+05 1.418352e+05 1.450530e+05 1.482814e+05 1.507819e+05 1.417013e+05 1.536021e+05 1.539259e+05 1.535305e+05 1.524210e+05 1.643219e+05 1.646457e+05 1.642503e+05 1.631408e+05 1.750416e+05 14859.454885

13915 rows × 41 columns

In [0]:
roi_28_18 = df.sort_values(by="roi_28_18", ascending = False)
In [0]:
df['roi_19_18'] = df[2019] - df[2018]
roi_19_18 = df.sort_values(by="roi_19_18", ascending = False)
In [0]:
df['roi_19_97'] = df[2019] - df[1997]
roi_19_97 = df.sort_values(by="roi_19_97", ascending = False)
In [81]:
roi_19_97
Out[81]:
RegionName RegionID City State Metro CountyName SizeRank 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 roi_28_18 roi_19_18 roi_19_97
8557 94027 97518 Atherton CA San Francisco-Oakland-Hayward San Mateo County 12336 5.304558e+05 7.045466e+05 8.576227e+05 9.897193e+05 1.260114e+06 1.434205e+06 1.587281e+06 1.719378e+06 1.989773e+06 2.163864e+06 2.316940e+06 2.449038e+06 2.719438e+06 2.893589e+06 3.046801e+06 3.179076e+06 3.449700e+06 3.624067e+06 3.777419e+06 3.909791e+06 4.180463e+06 4.354830e+06 4.508182e+06 4.231466e+06 4.752019e+06 4.842684e+06 4.912694e+06 4.962229e+06 5.482782e+06 5.573447e+06 5.643457e+06 5.692992e+06 6.213545e+06 1.338163e+06 153352.015236 3.977726e+06
6467 81611 93816 Aspen CO Glenwood Springs Pitkin County 8618 1.783877e+06 1.910365e+06 2.033188e+06 2.152338e+06 2.256877e+06 2.383366e+06 2.506189e+06 2.625338e+06 2.729877e+06 2.856366e+06 2.979189e+06 3.098338e+06 3.202878e+06 3.329368e+06 3.452276e+06 3.672239e+06 3.878162e+06 4.106218e+06 4.330629e+06 4.551366e+06 4.757771e+06 4.985847e+06 5.210257e+06 5.397618e+06 5.648056e+06 5.861444e+06 6.071170e+06 6.277247e+06 6.527684e+06 6.741073e+06 6.950798e+06 7.156875e+06 7.407312e+06 2.171028e+06 224410.496749 3.426380e+06
8933 2108 58622 Boston MA Boston-Cambridge-Newton Suffolk County 13039 1.374792e+06 1.533864e+06 1.676708e+06 1.803336e+06 1.978696e+06 2.137767e+06 2.280612e+06 2.407239e+06 2.582599e+06 2.741670e+06 2.884515e+06 3.011143e+06 3.186503e+06 3.345574e+06 3.488419e+06 3.615046e+06 3.790407e+06 3.949478e+06 4.092323e+06 4.218951e+06 4.394311e+06 4.553383e+06 4.696227e+06 4.564449e+06 4.933303e+06 5.027636e+06 5.105946e+06 5.168354e+06 5.537207e+06 5.631540e+06 5.709850e+06 5.772258e+06 6.141112e+06 1.218875e+06 142844.889036 3.321435e+06
275 10021 61635 New York NY New York-Newark-Jersey City New York County 326 4.123239e+06 4.360921e+06 4.584946e+06 4.795214e+06 4.691881e+06 4.929563e+06 5.153588e+06 5.363856e+06 5.260523e+06 5.498205e+06 5.722230e+06 5.932498e+06 5.829165e+06 6.066847e+06 6.290872e+06 6.501140e+06 6.397807e+06 6.635489e+06 6.859514e+06 7.069782e+06 6.966449e+06 7.204131e+06 7.428156e+06 7.772056e+06 7.834856e+06 8.017396e+06 8.186014e+06 8.340698e+06 8.403498e+06 8.586039e+06 8.754656e+06 8.909340e+06 8.972140e+06 1.705208e+06 224025.034311 3.304917e+06
11972 11962 62309 Sagaponack NY New York-Newark-Jersey City Suffolk County 20617 1.116978e+06 1.289223e+06 1.430647e+06 1.541256e+06 1.709738e+06 1.881984e+06 2.023407e+06 2.134016e+06 2.302498e+06 2.474744e+06 2.616167e+06 2.726777e+06 2.895258e+06 3.067504e+06 3.208927e+06 3.319537e+06 3.488024e+06 3.660275e+06 3.801704e+06 3.912318e+06 4.080805e+06 4.253056e+06 4.394485e+06 4.048675e+06 4.584962e+06 4.634189e+06 4.652946e+06 4.641456e+06 5.177744e+06 5.226970e+06 5.245728e+06 5.234238e+06 5.770525e+06 9.811816e+05 141428.616564 3.277507e+06
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
11205 89158 418163 Las Vegas NV Las Vegas-Henderson-Paradise Clark County 18265 5.702911e+05 5.720521e+05 5.729065e+05 5.728481e+05 5.525652e+05 5.543261e+05 5.551806e+05 5.551221e+05 5.348392e+05 5.366002e+05 5.374535e+05 5.373940e+05 5.171099e+05 5.188698e+05 5.197232e+05 5.196636e+05 4.993796e+05 5.011394e+05 5.019928e+05 5.019332e+05 4.816492e+05 4.834091e+05 4.842624e+05 4.924859e+05 4.832253e+05 4.813262e+05 4.785032e+05 4.747555e+05 4.654949e+05 4.635958e+05 4.607728e+05 4.570251e+05 4.477646e+05 -2.638395e+04 853.356576 -8.602867e+04
5439 38112 74650 Memphis TN Memphis Shelby County 7101 1.323592e+05 1.301804e+05 1.270570e+05 1.229880e+05 1.161575e+05 1.139787e+05 1.108553e+05 1.067863e+05 9.995582e+04 9.777699e+04 9.465364e+04 9.058459e+04 8.375414e+04 8.157531e+04 7.845196e+04 7.438291e+04 6.755245e+04 6.537363e+04 6.225027e+04 5.818122e+04 5.135077e+04 4.917194e+04 4.604859e+04 3.248057e+04 3.696522e+04 3.100765e+04 2.411047e+04 1.627889e+04 2.076353e+04 1.480597e+04 7.908787e+03 7.720745e+01 4.561849e+03 -4.909473e+04 -3123.352480 -8.631060e+04
6897 36105 73749 Montgomery AL Montgomery Montgomery County 9352 1.132547e+05 1.102328e+05 1.058050e+05 9.997140e+04 9.567297e+04 9.265106e+04 8.822332e+04 8.238970e+04 7.809127e+04 7.506936e+04 7.064161e+04 6.480799e+04 6.050957e+04 5.748771e+04 5.306063e+04 4.722910e+04 4.293539e+04 3.991966e+04 3.550085e+04 2.967616e+04 2.538670e+04 2.237372e+04 1.795491e+04 -7.597921e+03 4.902032e+03 -3.724897e+03 -1.374338e+04 -2.514386e+04 -1.264390e+04 -2.127083e+04 -3.128932e+04 -4.268980e+04 -3.018984e+04 -6.506352e+04 -4418.807737 -9.529976e+04
12025 73014 89851 Calumet OK Oklahoma City Canadian County 20781 2.438768e+05 2.417816e+05 2.382480e+05 2.332725e+05 2.188139e+05 2.167188e+05 2.131852e+05 2.082097e+05 1.937511e+05 1.916560e+05 1.881224e+05 1.831469e+05 1.686883e+05 1.665932e+05 1.630596e+05 1.580841e+05 1.436255e+05 1.415304e+05 1.379968e+05 1.330213e+05 1.185627e+05 1.164676e+05 1.129340e+05 9.871627e+04 1.015401e+05 9.368015e+04 8.438253e+04 7.365347e+04 7.647728e+04 6.861734e+04 5.931972e+04 4.859066e+04 5.141447e+04 -6.787693e+04 -3533.588225 -1.309428e+05
13640 44049 76963 Kipton OH Cleveland-Elyria Lorain County 28264 2.298177e+05 2.235728e+05 2.165064e+05 2.086180e+05 2.010576e+05 1.948127e+05 1.877463e+05 1.798579e+05 1.722975e+05 1.660526e+05 1.589862e+05 1.510978e+05 1.435373e+05 1.372923e+05 1.302259e+05 1.223374e+05 1.147769e+05 1.085320e+05 1.014655e+05 9.357710e+04 8.601661e+04 7.977166e+04 7.270520e+04 5.384215e+04 5.610730e+04 4.657902e+04 3.623555e+04 2.508183e+04 2.734697e+04 1.781870e+04 7.475225e+03 -3.678496e+03 -1.413354e+03 -8.345016e+04 -7066.463140 -1.571125e+05

13915 rows × 43 columns

In [0]:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from datetime import datetime

def prep_data_for_graph(df, first_col, last_col):
  top = df.head(10)
  print(top)

  def make_df(y, ds):
    row_df = pd.DataFrame({ "y": y.values, "ds": ds })
    row_df["ds"] = pd.to_datetime(row_df["ds"])
    return row_df

  def get_all(x):
    string = "" + x['City'] +", "+  x['State'] +", "+ str(x['RegionName'])
    return string


  i = list(top.columns).index(first_col)
  t = list(top.columns).index(last_col)
  # ds = top.columns[i:t+1]
  # # cols = top.columns[i:t+1]
  ds = top.columns[i:t+1]
  top['df'] = top.apply(lambda x: make_df(x[first_col:last_col], ds), axis=1) 
  # top['df'] = top.apply(lambda x: make_df(x['1997':'2019'], ds), axis=1) 
  top['combined'] = top.apply(lambda x: get_all(x), axis=1)
  return top
In [0]:
def graph_top(top, title):
  colors = sns.color_palette("Blues_d", n_colors=10)
  with sns.plotting_context("talk"):
    plt.figure(figsize=(8, 6))
    plt.plot('ds', 'y', data = top.iloc[0]['df'], label = ''+ top.iloc[0]['combined'] + '', linewidth=8, color= colors[0])
    plt.plot('ds', 'y', data = top.iloc[1]['df'], label = ''+ top.iloc[1]['combined'] + '', linewidth=8, color= colors[1])
    plt.plot('ds', 'y', data = top.iloc[2]['df'], label = ''+ top.iloc[2]['combined'] + '', linewidth=8, color= colors[2])
    plt.plot('ds', 'y', data = top.iloc[3]['df'], label = ''+ top.iloc[3]['combined'] + '', linestyle="dotted", linewidth=4, color= colors[3])
    plt.plot('ds', 'y', data = top.iloc[4]['df'], label = ''+ top.iloc[4]['combined'] + '', linestyle="dotted", linewidth=4, color= colors[4])
    plt.plot('ds', 'y', data = top.iloc[5]['df'], label = ''+ top.iloc[5]['combined'] + '', linestyle="dotted", linewidth=4, color= colors[5])
    plt.plot('ds', 'y', data = top.iloc[6]['df'], label = ''+ top.iloc[6]['combined'] + '', linestyle="dotted", linewidth=4, color= colors[6])
    plt.plot('ds', 'y', data = top.iloc[7]['df'], label = ''+ top.iloc[7]['combined'] + '', linestyle="dotted", linewidth=4, color= colors[7])
    plt.plot('ds', 'y', data = top.iloc[8]['df'], label = ''+ top.iloc[8]['combined'] + '', linestyle="dotted", linewidth=4, color= colors[8])
    plt.plot('ds', 'y', data = top.iloc[9]['df'], label = ''+ top.iloc[9]['combined'] + '', linestyle="dotted", linewidth=4, color= colors[9])
    # plt.title(title)
    plt.xlabel('Date')
    plt.ylabel('Average Home Price')
    
    plt.title("Best One Year Investment \n", loc='left', fontsize=24)
    plt.title("Predicted Housing Prices for greatest ROI 2019 - 2018", loc='right', fontsize=16, color='grey')
    
    plt.legend(loc = "center left", bbox_to_anchor = (1,.5), title = "City" )
In [0]:
df = new_df_sm.copy()
df.columns = [str(c) for c in df.columns]
In [0]:
df['roi_29_18'] = df['2029'] - df['2018']
df = df.sort_values(by='roi_29_18', ascending=False)
In [294]:
top = prep_data_for_graph(df, '1997', '2028')
graph_top(top, 'Predicted Housing Prices for greatest ROI 2019 - 2018')
       RegionName  RegionID  ...          2029     roi_29_18
6467        81611     93816  ...  7.407312e+06  2.421466e+06
8557        94027     97518  ...  6.213545e+06  1.858716e+06
275         10021     61635  ...  8.972140e+06  1.768008e+06
8933         2108     58622  ...  6.141112e+06  1.587729e+06
11972       11962     62309  ...  5.770525e+06  1.517469e+06
4107        33480     72636  ...  5.571661e+06  1.403712e+06
4182        90210     96086  ...  4.086202e+06  1.276086e+06
9333        11976     62321  ...  4.467197e+06  1.237088e+06
14          11201     62012  ...  4.297462e+06  1.221647e+06
8405        94028     97519  ...  4.339992e+06  1.221215e+06

[10 rows x 41 columns]
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:25: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:27: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:5: RuntimeWarning: Second argument 'y' is ambiguous: could be a color spec but is in data; using as data.  Either rename the entry in data or use three arguments to plot.
  """
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:6: RuntimeWarning: Second argument 'y' is ambiguous: could be a color spec but is in data; using as data.  Either rename the entry in data or use three arguments to plot.
  
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:7: RuntimeWarning: Second argument 'y' is ambiguous: could be a color spec but is in data; using as data.  Either rename the entry in data or use three arguments to plot.
  import sys
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:8: RuntimeWarning: Second argument 'y' is ambiguous: could be a color spec but is in data; using as data.  Either rename the entry in data or use three arguments to plot.
  
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:9: RuntimeWarning: Second argument 'y' is ambiguous: could be a color spec but is in data; using as data.  Either rename the entry in data or use three arguments to plot.
  if __name__ == '__main__':
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:10: RuntimeWarning: Second argument 'y' is ambiguous: could be a color spec but is in data; using as data.  Either rename the entry in data or use three arguments to plot.
  # Remove the CWD from sys.path while we load stuff.
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:11: RuntimeWarning: Second argument 'y' is ambiguous: could be a color spec but is in data; using as data.  Either rename the entry in data or use three arguments to plot.
  # This is added back by InteractiveShellApp.init_path()
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:12: RuntimeWarning: Second argument 'y' is ambiguous: could be a color spec but is in data; using as data.  Either rename the entry in data or use three arguments to plot.
  if sys.path[0] == '':
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:13: RuntimeWarning: Second argument 'y' is ambiguous: could be a color spec but is in data; using as data.  Either rename the entry in data or use three arguments to plot.
  del sys.path[0]
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:14: RuntimeWarning: Second argument 'y' is ambiguous: could be a color spec but is in data; using as data.  Either rename the entry in data or use three arguments to plot.
  
In [184]:
ddf.columns
Out[184]:
Index(['RegionName', 'RegionID', 'City', 'State', 'Metro', 'CountyName',
       'SizeRank', '1997', '1998', '1999', '2000', '2001', '2002', '2003',
       '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012',
       '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020', '2021',
       '2022', '2023', '2024', '2025', '2026', '2027', '2028', '2029'],
      dtype='object')
In [139]:
# ``
# i = list(roi_19_97.columns).index(1997)
# t = list(roi_19_97.columns).index(2029)
# ds = roi_19_97.columns[i:t+1]
  File "<ipython-input-139-5e893c5e7243>", line 1
    ``
    ^
SyntaxError: invalid syntax
In [95]:
ds
Out[95]:
Index([1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
       2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020,
       2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029],
      dtype='object')
In [115]:
df[1997:2029].values
Out[115]:
array([[32503, 72025, 'Pensacola', ..., 13415.145938048838,
        2439.324944505439, 68073.58877023548],
       [10301, 61777, 'New York', ..., 139537.9941916227,
        16253.88012530515, 350376.28513985587],
       [85257, 94849, 'Scottsdale', ..., 41429.55038492585,
        5098.252208032587, 161753.37711471418],
       ...,
       [80031, 93219, 'Westminster', ..., 46122.08569086075,
        6283.624252735055, 168055.68983238138],
       [97404, 99254, 'Eugene', ..., 25696.133263382595,
        5023.897008099768, 121967.92344510881],
       [40165, 75548, 'Shepherdsville', ..., 22101.061717464123,
        3302.4932674675365, 59729.98015002094]], dtype=object)
In [110]:
df
Out[110]:
RegionName RegionID City State Metro CountyName SizeRank 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 roi_28_18 roi_19_18 roi_19_97
0 60657 84654 Chicago IL Chicago-Naperville-Elgin Cook County 2 471939.146986 496487.087257 522374.359072 549597.800846 564426.006323 588973.946599 614861.218411 642080.732846 656903.847279 681444.165086 707317.035488 7.345223e+05 7.493324e+05 7.738621e+05 7.997312e+05 8.269365e+05 8.417464e+05 8.662762e+05 8.921453e+05 9.193505e+05 9.341605e+05 9.586903e+05 9.845594e+05 1.041382e+06 1.040300e+06 1.070158e+06 1.101328e+06 1.133797e+06 1.132714e+06 1.162573e+06 1.193742e+06 1.226211e+06 1.225129e+06 267520.326597 25869.088811 512620.204664
1 77494 91982 Katy TX Houston-The Woodlands-Sugar Land Harris County 4 202222.028612 207762.918144 212961.066732 217816.842570 223657.943941 229198.833509 234396.982068 239252.757916 245093.859298 250638.201717 255840.224392 2.607071e+05 2.665659e+05 2.721364e+05 2.773679e+05 2.850586e+05 2.937513e+05 3.021387e+05 3.101834e+05 3.178857e+05 3.265812e+05 3.349686e+05 3.430133e+05 3.452969e+05 3.580764e+05 3.650972e+05 3.717798e+05 3.781268e+05 3.909063e+05 3.979271e+05 4.046097e+05 4.109567e+05 4.237362e+05 75988.073436 8044.690445 140791.264590
2 60614 84616 Chicago IL Chicago-Naperville-Elgin Cook County 5 796920.397585 824024.164447 849791.908981 874214.243009 869097.909573 896201.676216 921969.420977 946391.754876 941275.421352 968379.178964 994146.907946 1.018569e+06 1.013452e+06 1.040555e+06 1.066322e+06 1.090743e+06 1.085626e+06 1.112729e+06 1.138496e+06 1.162917e+06 1.157800e+06 1.184903e+06 1.210669e+06 1.247033e+06 1.258160e+06 1.279870e+06 1.300220e+06 1.319207e+06 1.330333e+06 1.352044e+06 1.372393e+06 1.391380e+06 1.402507e+06 206477.881776 25766.835641 413749.020856
3 77449 91940 Katy TX Houston-The Woodlands-Sugar Land Harris County 6 91824.749488 95747.158288 98706.117626 100701.913820 104819.786172 108742.194970 111701.154312 113696.950513 117814.822871 121737.231672 124696.191015 1.266926e+05 1.308134e+05 1.347436e+05 1.377112e+05 1.397210e+05 1.438554e+05 1.477966e+05 1.507758e+05 1.527918e+05 1.569300e+05 1.608726e+05 1.638518e+05 1.512876e+05 1.669226e+05 1.670198e+05 1.661645e+05 1.643636e+05 1.799987e+05 1.800958e+05 1.792405e+05 1.774397e+05 1.930747e+05 16567.085390 2979.194564 72027.040492
4 77084 91733 Houston TX Houston-The Woodlands-Sugar Land Harris County 8 91459.742472 95429.981924 98406.642481 100389.968950 104448.220793 108418.460261 111395.120826 113378.447305 117437.724067 121408.985719 124386.668479 1.263710e+05 1.304339e+05 1.344147e+05 1.374060e+05 1.394107e+05 1.434962e+05 1.474937e+05 1.504996e+05 1.525123e+05 1.565999e+05 1.605995e+05 1.636055e+05 1.506939e+05 1.666394e+05 1.666729e+05 1.657240e+05 1.637997e+05 1.797452e+05 1.797787e+05 1.788298e+05 1.769055e+05 1.928510e+05 16306.034327 3005.977937 72145.733133
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
13910 47986 78883 Oxford IN Lafayette-West Lafayette Benton County 30383 66037.989375 66339.088058 66628.620749 66905.727509 64451.358133 64752.456813 65041.989476 65319.096199 62864.709569 63165.685591 63454.504079 6.373083e+04 6.127555e+04 6.157573e+04 6.186435e+04 6.214054e+04 5.968526e+04 5.998544e+04 6.027406e+04 6.055025e+04 5.809497e+04 5.839515e+04 5.868377e+04 6.151348e+04 5.922287e+04 5.947162e+04 5.970535e+04 5.992320e+04 5.763258e+04 5.788133e+04 5.811506e+04 5.833291e+04 5.604229e+04 -62.245970 288.618903 -7354.217557
13911 89155 95851 Las Vegas NV Las Vegas-Henderson-Paradise Clark County 30386 250691.446764 255028.623188 258459.285007 260983.330300 264084.518904 268421.695325 271852.357148 274376.402445 277477.591049 281814.767023 285245.428393 2.877695e+05 2.908707e+05 2.952078e+05 2.986385e+05 3.011625e+05 3.042637e+05 3.086009e+05 3.120316e+05 3.145556e+05 3.176568e+05 3.219940e+05 3.254246e+05 3.156357e+05 3.295675e+05 3.302840e+05 3.301024e+05 3.290288e+05 3.429606e+05 3.436770e+05 3.434955e+05 3.424218e+05 3.563536e+05 20427.861348 3430.661359 74733.192551
13912 55144 82132 North Saint Paul MN Minneapolis-St. Paul-Bloomington Ramsey County 30394 76857.478471 82633.187309 87967.752763 92860.388688 95856.195633 101631.904482 106966.469947 111859.105861 114854.912788 120630.621620 125965.187071 1.308578e+05 1.338536e+05 1.396293e+05 1.449639e+05 1.498565e+05 1.528523e+05 1.586281e+05 1.639626e+05 1.688553e+05 1.718511e+05 1.776268e+05 1.829613e+05 1.840168e+05 1.923046e+05 1.963140e+05 1.998836e+05 2.030155e+05 2.113034e+05 2.153127e+05 2.188823e+05 2.220142e+05 2.303021e+05 44387.452046 5334.565462 106103.860078
13913 4033 59316 Cumberland ME Portland-South Portland Cumberland County 30406 444447.599617 466985.532392 489652.665437 512441.900874 511143.936786 533681.869435 556349.002322 579134.788063 577833.185287 600363.857043 623023.102601 6.458045e+05 6.444986e+05 6.670286e+05 6.896879e+05 7.124692e+05 7.111633e+05 7.336934e+05 7.563526e+05 7.791340e+05 7.778281e+05 8.003581e+05 8.230174e+05 8.713253e+05 8.686947e+05 8.916974e+05 9.147987e+05 9.379900e+05 9.353594e+05 9.583622e+05 9.814635e+05 1.004655e+06 1.002024e+06 204296.675464 22659.242402 378569.764406
13914 86343 95186 Crown King AZ Prescott Yavapai County 30409 91454.193554 94682.526922 97183.095405 98956.171309 102173.960151 105402.293517 107902.861999 109675.937901 112893.726742 116122.060107 118622.628589 1.203957e+05 1.236135e+05 1.268418e+05 1.293424e+05 1.311155e+05 1.343333e+05 1.375616e+05 1.400622e+05 1.418352e+05 1.450530e+05 1.482814e+05 1.507819e+05 1.417013e+05 1.536021e+05 1.539259e+05 1.535305e+05 1.524210e+05 1.643219e+05 1.646457e+05 1.642503e+05 1.631408e+05 1.750416e+05 14859.454885 2500.568486 59327.734849

13915 rows × 43 columns

In [153]:
df.dtypes
Out[153]:
RegionName      int64
RegionID        int64
City           object
State          object
Metro          object
CountyName     object
SizeRank        int64
1997          float64
1998          float64
1999          float64
2000          float64
2001          float64
2002          float64
2003          float64
2004          float64
2005          float64
2006          float64
2007          float64
2008          float64
2009          float64
2010          float64
2011          float64
2012          float64
2013          float64
2014          float64
2015          float64
2016          float64
2017          float64
2018          float64
2019          float64
2020          float64
2021          float64
2022          float64
2023          float64
2024          float64
2025          float64
2026          float64
2027          float64
2028          float64
2029          float64
dtype: object
In [197]:
df
Out[197]:
RegionName RegionID City State Metro CountyName SizeRank 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029
0 60657 84654 Chicago IL Chicago-Naperville-Elgin Cook County 2 471939.146986 496487.087257 522374.359072 549597.800846 564426.006323 588973.946599 614861.218411 642080.732846 656903.847279 681444.165086 707317.035488 7.345223e+05 7.493324e+05 7.738621e+05 7.997312e+05 8.269365e+05 8.417464e+05 8.662762e+05 8.921453e+05 9.193505e+05 9.341605e+05 9.586903e+05 9.845594e+05 1.041382e+06 1.040300e+06 1.070158e+06 1.101328e+06 1.133797e+06 1.132714e+06 1.162573e+06 1.193742e+06 1.226211e+06 1.225129e+06
1 77494 91982 Katy TX Houston-The Woodlands-Sugar Land Harris County 4 202222.028612 207762.918144 212961.066732 217816.842570 223657.943941 229198.833509 234396.982068 239252.757916 245093.859298 250638.201717 255840.224392 2.607071e+05 2.665659e+05 2.721364e+05 2.773679e+05 2.850586e+05 2.937513e+05 3.021387e+05 3.101834e+05 3.178857e+05 3.265812e+05 3.349686e+05 3.430133e+05 3.452969e+05 3.580764e+05 3.650972e+05 3.717798e+05 3.781268e+05 3.909063e+05 3.979271e+05 4.046097e+05 4.109567e+05 4.237362e+05
2 60614 84616 Chicago IL Chicago-Naperville-Elgin Cook County 5 796920.397585 824024.164447 849791.908981 874214.243009 869097.909573 896201.676216 921969.420977 946391.754876 941275.421352 968379.178964 994146.907946 1.018569e+06 1.013452e+06 1.040555e+06 1.066322e+06 1.090743e+06 1.085626e+06 1.112729e+06 1.138496e+06 1.162917e+06 1.157800e+06 1.184903e+06 1.210669e+06 1.247033e+06 1.258160e+06 1.279870e+06 1.300220e+06 1.319207e+06 1.330333e+06 1.352044e+06 1.372393e+06 1.391380e+06 1.402507e+06
3 77449 91940 Katy TX Houston-The Woodlands-Sugar Land Harris County 6 91824.749488 95747.158288 98706.117626 100701.913820 104819.786172 108742.194970 111701.154312 113696.950513 117814.822871 121737.231672 124696.191015 1.266926e+05 1.308134e+05 1.347436e+05 1.377112e+05 1.397210e+05 1.438554e+05 1.477966e+05 1.507758e+05 1.527918e+05 1.569300e+05 1.608726e+05 1.638518e+05 1.512876e+05 1.669226e+05 1.670198e+05 1.661645e+05 1.643636e+05 1.799987e+05 1.800958e+05 1.792405e+05 1.774397e+05 1.930747e+05
4 77084 91733 Houston TX Houston-The Woodlands-Sugar Land Harris County 8 91459.742472 95429.981924 98406.642481 100389.968950 104448.220793 108418.460261 111395.120826 113378.447305 117437.724067 121408.985719 124386.668479 1.263710e+05 1.304339e+05 1.344147e+05 1.374060e+05 1.394107e+05 1.434962e+05 1.474937e+05 1.504996e+05 1.525123e+05 1.565999e+05 1.605995e+05 1.636055e+05 1.506939e+05 1.666394e+05 1.666729e+05 1.657240e+05 1.637997e+05 1.797452e+05 1.797787e+05 1.788298e+05 1.769055e+05 1.928510e+05
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
13910 47986 78883 Oxford IN Lafayette-West Lafayette Benton County 30383 66037.989375 66339.088058 66628.620749 66905.727509 64451.358133 64752.456813 65041.989476 65319.096199 62864.709569 63165.685591 63454.504079 6.373083e+04 6.127555e+04 6.157573e+04 6.186435e+04 6.214054e+04 5.968526e+04 5.998544e+04 6.027406e+04 6.055025e+04 5.809497e+04 5.839515e+04 5.868377e+04 6.151348e+04 5.922287e+04 5.947162e+04 5.970535e+04 5.992320e+04 5.763258e+04 5.788133e+04 5.811506e+04 5.833291e+04 5.604229e+04
13911 89155 95851 Las Vegas NV Las Vegas-Henderson-Paradise Clark County 30386 250691.446764 255028.623188 258459.285007 260983.330300 264084.518904 268421.695325 271852.357148 274376.402445 277477.591049 281814.767023 285245.428393 2.877695e+05 2.908707e+05 2.952078e+05 2.986385e+05 3.011625e+05 3.042637e+05 3.086009e+05 3.120316e+05 3.145556e+05 3.176568e+05 3.219940e+05 3.254246e+05 3.156357e+05 3.295675e+05 3.302840e+05 3.301024e+05 3.290288e+05 3.429606e+05 3.436770e+05 3.434955e+05 3.424218e+05 3.563536e+05
13912 55144 82132 North Saint Paul MN Minneapolis-St. Paul-Bloomington Ramsey County 30394 76857.478471 82633.187309 87967.752763 92860.388688 95856.195633 101631.904482 106966.469947 111859.105861 114854.912788 120630.621620 125965.187071 1.308578e+05 1.338536e+05 1.396293e+05 1.449639e+05 1.498565e+05 1.528523e+05 1.586281e+05 1.639626e+05 1.688553e+05 1.718511e+05 1.776268e+05 1.829613e+05 1.840168e+05 1.923046e+05 1.963140e+05 1.998836e+05 2.030155e+05 2.113034e+05 2.153127e+05 2.188823e+05 2.220142e+05 2.303021e+05
13913 4033 59316 Cumberland ME Portland-South Portland Cumberland County 30406 444447.599617 466985.532392 489652.665437 512441.900874 511143.936786 533681.869435 556349.002322 579134.788063 577833.185287 600363.857043 623023.102601 6.458045e+05 6.444986e+05 6.670286e+05 6.896879e+05 7.124692e+05 7.111633e+05 7.336934e+05 7.563526e+05 7.791340e+05 7.778281e+05 8.003581e+05 8.230174e+05 8.713253e+05 8.686947e+05 8.916974e+05 9.147987e+05 9.379900e+05 9.353594e+05 9.583622e+05 9.814635e+05 1.004655e+06 1.002024e+06
13914 86343 95186 Crown King AZ Prescott Yavapai County 30409 91454.193554 94682.526922 97183.095405 98956.171309 102173.960151 105402.293517 107902.861999 109675.937901 112893.726742 116122.060107 118622.628589 1.203957e+05 1.236135e+05 1.268418e+05 1.293424e+05 1.311155e+05 1.343333e+05 1.375616e+05 1.400622e+05 1.418352e+05 1.450530e+05 1.482814e+05 1.507819e+05 1.417013e+05 1.536021e+05 1.539259e+05 1.535305e+05 1.524210e+05 1.643219e+05 1.646457e+05 1.642503e+05 1.631408e+05 1.750416e+05

13915 rows × 40 columns

In [0]:
mine = df[df['RegionName'] == 90042]
In [200]:
mine['roi'] = mine['2029'] - mine['2020']
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:1: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  """Entry point for launching an IPython kernel.
In [201]:
mine
Out[201]:
RegionName RegionID City State Metro CountyName SizeRank 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 roi
585 90042 96023 Los Angeles CA Los Angeles-Long Beach-Anaheim Los Angeles County 686 149771.724947 174584.327006 196660.013414 216003.533548 253502.675674 278315.277791 300390.964255 319734.484417 357233.626537 382046.228635 404121.915058 423465.435172 460964.577268 485777.179339 507852.865743 527196.385858 564695.528005 589508.130099 611583.816541 630927.336691 668426.478811 693239.080899 715314.767341 681239.525894 751279.109302 765191.404501 776414.025872 784970.476694 855010.060102 868922.355301 880144.976672 888701.427494 958741.010902 277501.485008
In [285]:
blues = sns.palplot(sns.color_palette("Blues_d", n_colors=10))
In [266]:
sns.palplot(sns.color_palette("Oranges_d", n_colors=10)[1])
In [279]:
sns.palplot(sns.color_palette("Oranges_d", n_colors=10))
In [0]:
 
In [286]:
blues[1]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-286-3ec727638696> in <module>()
----> 1 blues[1]

TypeError: 'NoneType' object is not subscriptable
In [287]:
blues = (sns.color_palette("Blues_d", n_colors=10)
  File "<ipython-input-287-d2e351711367>", line 1
    blues = (sns.color_palette("Blues_d", n_colors=10)
                                                      ^
SyntaxError: unexpected EOF while parsing
In [0]:
blues = sns.color_palette("Blues_d", n_colors=10)
In [289]:
blues[0]
Out[289]:
(0.20282968089196465, 0.25942329873125725, 0.29998205818275026)
In [0]: