In [0]:
import pandas as pd
from fbprophet import Prophet 
from google.colab import files

STEP 1: Get the Data

In [0]:
og_df = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/Zip_Zhvi_SingleFamilyResidence.csv', encoding='latin')
In [0]:
# ----- USE CALIFORNIA AS AN EXAMPLE BC CALIFORNIA IS BEST STATE DUH
# CA = og_df[og_df['State'] == 'CA']
# ca_df = pd.DataFrame(CA.describe())
# ca_df

STEP 2: Prep the data for Visualizations

Find NAs

In [0]:
from IPython.display import display
pd.options.display.max_columns = None
pd.options.display.max_rows = None
df = og_df.copy()
df.isna().sum()

2.1 -- Group by State

In [0]:
df = og_df.copy()
zips_per_state = []
for state in set(df['State']):
  state_df = df[df['State'] == state]
  state_df_desc = pd.DataFrame(state_df.describe())
  metro = len(set(state_df['Metro']))

  avg_price_97 = state_df_desc['1997-01']['mean']
  max_price_97 = state_df_desc['1997-01']['max']
  min_price_97 = state_df_desc['1997-01']['max']
  std_price_97 = state_df_desc['1997-01']['std']

  avg_price_19 = state_df_desc['2019-12']['mean']
  max_price_19 = state_df_desc['2019-12']['max']
  min_price_19 = state_df_desc['2019-12']['max']
  std_price_19 = state_df_desc['2019-12']['std']

  zips_per_state.append({ "state": state, 
                         "zips": len(state_df), 
                         "metros": metro,
                         "avg_price_97": avg_price_97,
                         "max_price_97": max_price_97,
                         "min_price_97": min_price_97,
                         "std_price_97": std_price_97,
                         "avg_price_19": avg_price_19,
                         "max_price_19": max_price_19,
                         "min_price_19": min_price_19,
                         "std_price_19": std_price_19
                         })
  # print(state, len(state_df), metro)

# ----- UNCOMMENT TO SAVE TO FILE
# zps = pd.DataFrame(zips_per_state)
# zps.to_csv('zips_per_state.csv')
# files.download('zips_per_state.csv')

2.1 -- Group by Metro

In [0]:
df = og_df.copy()
zips_per_metro = []
for metro in set(df['Metro']):
  metro_df = df[df['Metro'] == metro]
  metro_df_desc = pd.DataFrame(metro_df.describe())
  # metro = len(set(metro_df['Metro']))

  avg_price_97 = metro_df_desc['1997-01']['mean']
  max_price_97 = metro_df_desc['1997-01']['max']
  min_price_97 = metro_df_desc['1997-01']['max']
  std_price_97 = metro_df_desc['1997-01']['std']

  avg_price_19 = metro_df_desc['2019-12']['mean']
  max_price_19 = metro_df_desc['2019-12']['max']
  min_price_19 = metro_df_desc['2019-12']['max']
  std_price_19 = metro_df_desc['2019-12']['std']

  zips_per_metro.append({ "metro": metro, 
                         "zips": len(metro_df), 
                        #  "metros": metro,
                         "avg_price_97": avg_price_97,
                         "max_price_97": max_price_97,
                         "min_price_97": min_price_97,
                         "std_price_97": std_price_97,
                         "avg_price_19": avg_price_19,
                         "max_price_19": max_price_19,
                         "min_price_19": min_price_19,
                         "std_price_19": std_price_19
                         })
# ----- UNCOMMENT TO SAVE TO FILE
# zps = pd.DataFrame(zips_per_metro)
# zps.to_csv('zips_per_metro.csv')
# files.download('zips_per_metro.csv')
In [0]:
# 

STEP 3: Run Prophet on ONE zip code

In [0]:
df = og_df.copy()
ds = df.columns[7:]
region_row = df[df['RegionName'] == 90039]
r_df = pd.DataFrame({ 'y': region_row.loc[:, "1996-04"::].values[0], 'ds': ds })
m = Prophet()
m.fit(r_df)
future = m.make_future_dataframe(periods=60, freq='M')
forecast = m.predict(future)
fig1 = m.plot(forecast)
INFO:fbprophet:Disabling weekly seasonality. Run prophet with weekly_seasonality=True to override this.
INFO:fbprophet:Disabling daily seasonality. Run prophet with daily_seasonality=True to override this.

STEP 4: Run Prophet on ALL 30k Zip Codes

Process run in separate file. Results exported, saved to github and imported below --

In [0]:
df1 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_1000.csv')
df2 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_2000.csv')
df3 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_4000.csv')
df4 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_6000.csv')
df5 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_8000.csv')
df6 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_13000a.csv')
df7 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_13000b.csv')
df8 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_15000.csv')
df9 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_17000.csv')
df10 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_19000.csv')
df11 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_21000.csv')
df12 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_22000.csv')
df13 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_24000.csv')
df14 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_26000.csv')
df15 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_28000.csv')
df16 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_30000.csv')
df17 = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/bigger_df_-1.csv')
In [0]:
 
In [0]:
# combine the data
df_all = pd.concat([df1, df2, df3, df4, df5, df6, df7, df8, df9, df10, df11, df12, df13, df14, df15, df16, df17], axis=1)
df = df_all.copy()
df = df.loc[:,~df.columns.duplicated()]
In [0]:
# confirm we have the correct number of zip codes
len(df.T)
Out[0]:
30433
In [0]:
# shoot, looks like we're one short. Let's compare with our original list of zips
# oh well, we can just run these manually
og_RegionNames = list(og_df['RegionName'].values)
og_RegionNames_str = [str(region) for region in og_RegionNames]
df_RegionNames = list(df.columns)
diff = list(set(og_RegionNames_str) - set(df_RegionNames))
diff
Out[0]:
['99901', '42464']
In [0]:
# also, looks like our column names don't actually look like the zip codes they are representing
new_cols = []
for column in df.columns:
  if len(column) == 3:
    new_cols.append('00'+ str(column)) 
  elif len(column) == 4:
    new_cols.append('0'+ str(column))
  else:
    new_cols.append(str(column))
df.columns = new_cols
In [0]:
# and we didn't import our date column
df['Unnamed: 0'] = forecast['ds']
cols = df.columns.values
cols[0] = 'forecast'
df.columns = cols
In [0]:
df_t = df.T
In [0]:
df_t.to_csv('30k_zips_with_prophet.csv')
In [0]:
files.download('30k_zips_with_prophet.csv')
In [0]:
df_t_a = df_t[df_t.columns[0:150]]
df_t_b = df_t[df_t.columns[150:]]
In [0]:
df_t_a.to_csv('30k_zips_with_prophet_A.csv')
df_t_b.to_csv('30k_zips_with_prophet_B.csv')
In [0]:
files.download('30k_zips_with_prophet_A.csv')
files.download('30k_zips_with_prophet_B.csv')
In [0]:
zips = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/DMA-zip.csv')
In [0]:
zips
Out[0]:
FIPS COUNTY ST DMA CODE DMA NAME ZIPCODE
0 1001 Autauga AL 698 MONTGOMERY 36003
1 1001 Autauga AL 698 MONTGOMERY 36006
2 1001 Autauga AL 698 MONTGOMERY 36008
3 1001 Autauga AL 698 MONTGOMERY 36051
4 1001 Autauga AL 698 MONTGOMERY 36066
... ... ... ... ... ... ...
41530 56043 Washakie WY 767 CASPER-RIVERTON 82442
41531 56045 Weston WY 764 RAPID CITY 82701
41532 56045 Weston WY 764 RAPID CITY 82715
41533 56045 Weston WY 764 RAPID CITY 82723
41534 56045 Weston WY 764 RAPID CITY 82730

41535 rows × 6 columns

In [0]:
df
Out[0]:
Unnamed: 0 501 544 601 602 603 604 605 606 610 611 612 613 617 622 624 693 703 705 715 718 727 728 730 733 734 737 742 765 772 775 791 794 802 803 820 821 822 830 840 ... 99550 99556 99567 99568 99572 99574 99577 99587 99603 99605 99610 99611 99615 99623 99631 99635 99639 99645 99652 99654 99663 99664 99669 99672 99674 99676 99683 99686 99688 99701 99705 99709 99712 99714 99762 99801 99824 99827 99833 99835
0 0 143407.576125 63290.168797 29111.920044 76054.548280 76584.044961 64260.067239 117540.716669 56384.671533 30109.599521 47646.826957 2323.746659 -84764.945230 -59575.940042 -276743.761469 -4269.454266 181164.685634 -58120.323291 157240.959814 49810.819278 628171.750285 -9793.501644 49758.540520 46140.756171 -218788.562875 4.895891e+05 318382.512567 379710.812622 271366.715800 -113256.375013 62435.164498 -144985.485673 3219.763814 -83699.261067 -172715.957731 140262.015973 267004.107460 66901.608342 -57517.282136 -828685.314572 ... 197057.389618 71378.555494 176298.325769 71594.624916 66707.670353 335827.294210 191934.183996 260529.149377 93311.504894 64308.588473 83641.843400 91357.844521 163075.498358 93381.746129 88019.436974 191369.999565 93340.197460 139208.544095 115002.818661 133529.647247 60509.065153 119018.593867 95829.515582 104700.402447 117609.571311 73018.426565 78336.037481 -19188.027979 101263.483083 111665.409386 131363.930127 125131.404021 129805.379099 73630.816534 1.512837e+06 176652.357388 209501.596211 300557.074951 303307.834218 151600.958560
1 1 143125.182109 63260.943603 29995.868481 75995.979989 76290.088877 64143.546612 117614.624528 56522.036816 30050.326430 47643.747092 2328.332320 -83964.689126 -58509.277979 -275290.103691 -3086.354613 180828.750494 -57183.147929 157239.169684 50115.692292 625955.040335 -9673.099334 49997.610709 46262.589486 -217812.111338 4.885431e+05 317801.872080 381700.362043 271723.293891 -112302.531032 62692.701059 -144198.357287 3689.146513 -82452.906740 -170507.956206 140610.237158 266774.071416 68090.824063 -55383.871672 -823294.198486 ... 196452.728345 71620.185925 176870.754081 71813.540967 68357.872410 335895.963854 192310.855948 260535.817380 93671.441757 64687.493445 83726.377937 91462.735592 163550.815699 93805.753847 87946.246515 190956.302842 93108.066096 139996.182678 115545.474815 134323.665660 60749.265458 119022.398297 95949.402557 104720.843734 118078.332857 73024.595991 79251.089876 -18050.163067 101190.381022 111721.800470 131291.104008 125246.082528 129716.834758 73481.551862 1.507610e+06 177270.298510 209456.875948 299634.307652 303412.478613 152265.191991
2 2 142729.257001 63480.365321 30855.959015 75995.312916 75965.931743 63890.502130 117608.896462 56617.605976 30210.940041 47646.801430 2469.386577 -82747.387891 -57740.131224 -266918.228242 -2158.107957 180717.927722 -57095.795872 157249.178704 50141.625433 623492.331120 -9566.989508 50016.307005 46707.903916 -216354.897061 4.886214e+05 316982.001421 384857.482239 271130.136862 -112029.928442 62699.348399 -144242.329311 4192.072631 -80750.436014 -167595.266447 141198.424627 266678.452958 68824.202176 -55814.756100 -824557.046497 ... 196232.819922 72120.979544 177315.196292 72543.593879 70710.788207 335002.954962 192573.924595 260957.411033 94609.560767 65700.440350 84158.282397 92002.886651 163945.926440 94378.027395 88377.763226 190641.773838 93247.704643 140747.163309 115491.670187 135053.842845 61105.143799 119391.194226 96647.210335 105125.488759 117858.286577 73156.315278 80083.350028 -16536.962861 101438.914618 112070.606888 131284.201103 125515.815460 129812.191558 73779.233605 1.498475e+06 178272.353880 209562.852381 299470.332456 303752.307085 153546.229298
3 3 142439.958760 63775.799661 31839.530691 75870.859190 75962.592514 63851.327955 117411.039378 57386.709178 30396.719523 47782.971991 2376.343387 -81470.329785 -56659.057411 -265565.113818 -1252.525327 180215.937226 -56082.883974 156924.825824 50248.833075 620032.523316 -9483.619471 50169.008519 46678.273617 -214177.269995 4.898479e+05 315803.240842 384805.938625 270256.011749 -109959.280179 62745.088226 -142639.806687 4364.927054 -80001.800412 -165526.533333 140714.160863 265988.575053 68310.428287 -54279.674965 -824937.458543 ... 196334.406871 72760.081511 177925.911061 73441.069229 73529.975340 334704.220206 193301.685947 261193.651849 95883.854801 66408.280892 84880.636448 92922.596311 164823.230808 95270.736425 88886.267751 190517.206094 93638.860435 141565.201928 115725.289842 135981.489382 62173.286131 120255.856370 97768.840136 106023.727759 118053.331767 73351.301963 80682.982001 -14849.370714 101575.577544 112431.519940 131383.944928 126133.391473 130179.884238 74202.290156 1.502104e+06 179488.847962 209972.554414 299114.578499 303531.828032 155055.514597
4 4 142142.212051 64237.099070 32257.789948 75537.394757 75926.434244 64011.034387 116703.468243 57786.971268 30540.436267 47899.857180 2849.784251 -80721.119639 -56211.451841 -264104.528686 -987.768990 179654.460675 -56179.068616 156640.709610 50420.962285 616969.100529 -8749.318305 50230.981457 46788.980860 -212361.949264 4.892865e+05 314590.012626 382425.780534 268977.104779 -111169.469382 62567.165361 -141504.046803 3825.365939 -79209.038250 -164764.889409 139854.300609 265101.682908 68085.637440 -54218.984640 -823385.597946 ... 196057.889173 73111.495498 178470.660902 74171.549688 76161.743181 333981.589870 194268.653061 261385.929139 96637.757898 66793.365502 85390.538668 93458.768614 165198.188780 95660.737802 89215.715974 190213.447331 93937.002817 141691.576901 115677.946917 136322.808770 63213.871569 120680.187893 98480.120913 106519.987359 117899.612692 73127.867874 80260.556613 -13631.641168 101332.176830 112570.467956 131652.222441 126525.671379 130678.419478 74847.815250 1.502318e+06 180696.224790 210623.100721 298849.437878 302635.859569 156198.239690
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
340 340 121716.341915 99197.693221 187289.971957 82374.521128 84050.474534 75683.140752 139542.646531 98001.998131 74806.729875 89754.591728 140635.072686 105389.552911 152295.826516 233108.257488 168486.062904 87359.751291 47275.531057 163057.345824 210743.129061 279220.842344 97426.956610 88232.205176 106899.409533 196167.574604 1.062757e+06 84445.629751 269748.186863 178871.533252 263231.258156 140009.592649 238304.808036 151264.258754 155643.785756 116828.430206 112759.371673 159005.590759 199654.027499 293723.096304 271737.597702 ... 198231.851204 181474.721026 428250.394151 197704.873959 377059.469988 368475.345283 403714.079329 520245.527324 296990.025839 184492.127111 228268.515910 254470.944855 358705.447601 259226.232753 245363.790693 166092.976985 155414.060478 300901.175013 204290.822933 305095.800502 188400.757152 278540.702626 285868.732812 286721.318265 211802.672054 181352.047198 150794.116100 307386.292504 197746.981698 223619.207003 283272.490378 290095.237350 283505.005278 167494.623790 3.016878e+05 476101.485031 445057.645614 263308.459336 293392.507755 424349.266750
341 341 122198.999333 99691.238264 188398.833025 82682.380753 83692.351251 75835.789817 140410.036488 98361.594554 74884.888964 90128.470616 140522.086540 106661.270793 152952.912543 233441.621373 169493.269779 88505.399092 46186.979876 162822.039870 211209.896265 280091.372955 97629.716254 88256.609095 107246.287738 197876.588695 1.070391e+06 84254.032205 272024.448324 179158.132628 264016.756140 140512.179504 237443.215542 152178.545658 156526.211511 118195.058047 114362.244929 160479.327803 201041.543102 293257.961705 266892.196608 ... 199522.076785 181616.877979 428284.830936 198044.819754 377825.356299 368550.773577 403071.794900 521361.128785 297719.469940 184958.292056 228501.076986 254926.559490 359786.543690 259428.947446 245942.944193 166124.845400 155531.120331 301495.184618 204087.642055 305404.743558 187890.262864 279460.175067 286452.966745 287368.350678 211543.634508 181691.407691 151721.224694 308286.201287 198383.938234 223986.682169 282978.269328 290505.301172 283882.879788 167629.189467 3.007702e+05 476751.658349 445330.276993 263814.868459 294316.470191 424461.743509
342 342 122581.420410 100621.712213 189768.602828 82838.544528 83640.546126 76733.845875 140831.658381 98953.738626 75047.811634 90389.890028 139939.763127 107049.083076 153000.792558 234760.794773 170706.698418 89211.817420 46004.369213 163025.960387 212516.655775 280108.886379 98203.932480 88688.050926 107718.843881 200460.637973 1.078579e+06 84543.532525 275427.961163 178914.199285 267123.547817 140403.008532 238429.750665 152268.703527 157161.089383 118694.924219 114734.560360 161886.102262 202195.711127 293113.807941 262747.039574 ... 200620.303107 182029.483628 428598.522432 198684.903840 380206.859254 368944.857542 403206.377535 522368.940879 298983.997614 186190.803064 229190.883760 255756.837816 361054.259405 260608.886532 247058.570145 166764.857268 156389.943534 302576.062423 204592.055552 306308.561193 188944.343910 280588.165152 287501.258402 288409.801354 212491.144795 182991.217632 152449.489960 307768.002059 199420.109162 223998.674195 282503.377502 290847.045888 284066.239064 167980.897064 3.034136e+05 477723.474517 446311.617336 264598.094311 294980.067922 425419.489190
343 343 123121.604603 100568.978389 190018.621829 82522.395916 83905.606147 76772.491846 140849.129280 99412.134414 75174.214254 90327.732612 139860.887844 106257.624891 153996.783426 234261.271178 171394.462839 89605.497852 45454.661675 162705.736037 213752.072438 279863.765373 99058.208247 89041.719299 107939.448929 203605.406156 1.083568e+06 84449.488157 274992.112620 178657.538974 272932.907816 140825.443583 237815.617007 151080.616692 156693.996179 118010.466334 113979.381196 162092.504616 202425.088210 293938.034887 260966.739849 ... 200689.501185 182465.356786 428860.823391 199313.085537 381930.494038 369707.979699 403748.557125 523536.623128 300000.069731 186943.780759 229753.037589 256447.368187 361969.092339 261455.907653 247986.013952 165877.306377 157119.465637 302884.204757 204843.874935 306543.369964 190053.078189 281344.630170 288302.867474 288978.381406 212666.604236 183672.758797 152359.548155 307791.548525 200167.638446 223743.333288 282626.154770 291140.756324 284783.214724 168659.848150 3.026156e+05 478727.842731 447646.838789 266011.431241 295463.867616 426300.353098
344 344 123729.181808 100424.000370 189822.891491 82486.316346 84274.309169 76464.826871 141486.945409 98928.840270 75835.247594 90647.104120 140129.204171 104621.606076 154762.443417 235018.626962 171148.396541 89518.496340 45614.555609 162331.012255 214739.685859 281286.567375 99256.616967 89312.506479 108124.860071 206318.095678 1.082999e+06 84019.567202 274476.485407 179247.348819 278298.265252 140951.929580 238330.150121 150721.054805 156437.981413 116149.637583 112940.106381 161545.416068 201474.646110 296039.977883 265875.717308 ... 201311.878681 183030.429196 429667.478310 200238.278106 383086.086903 370017.153207 405052.861350 525895.970861 301249.738601 187429.860778 230781.139192 257395.756143 362449.798419 262195.013959 249406.566918 164972.228852 157823.800569 302557.338163 204839.396911 306547.198742 191347.850265 282417.254623 289387.741967 289937.706165 212609.661265 184111.082551 151497.301503 307610.386243 200542.825575 224339.419903 283527.696426 292235.658627 286011.106782 169661.641974 3.008051e+05 480450.122788 449850.948941 267678.453787 295453.076324 426931.751220

345 rows × 30433 columns

In [0]:
new_cols = []
for column in df.columns:
  if len(column) == 3:
    new_cols.append('00'+ str(column)) 
  elif len(column) == 4:
    new_cols.append('0'+ str(column))
  else:
    new_cols.append(str(column))
In [0]:
df.columns = new_cols
In [0]:
df.columns
Out[0]:
Index(['RegionID', 'RegionName', 'City', 'State', 'Metro', 'CountyName',
       'SizeRank', '1996-04', '1996-05', '1996-06',
       ...
       '2019-03', '2019-04', '2019-05', '2019-06', '2019-07', '2019-08',
       '2019-09', '2019-10', '2019-11', '2019-12'],
      dtype='object', length=292)
In [0]:
forecast['ds']
Out[0]:
0     1996-04-01
1     1996-05-01
2     1996-06-01
3     1996-07-01
4     1996-08-01
         ...    
340   2024-07-31
341   2024-08-31
342   2024-09-30
343   2024-10-31
344   2024-11-30
Name: ds, Length: 345, dtype: datetime64[ns]
In [1]:
from google.colab import drive # import drive from google colab

ROOT = "/content/drive"     # default location for the drive
print(ROOT)                 # print content of ROOT (Optional)

drive.mount(ROOT)           # we mount the google drive at /content/drive
/content/drive
Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&response_type=code&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly

Enter your authorization code:
··········
Mounted at /content/drive
In [2]:
%pwd
Out[2]:
'/content'
In [3]:
%ls
drive/  sample_data/
In [0]:
 
In [6]:
path = "/content/drive/My Drive/data/30k_zips_with_prophet.csv"
df_bonus = pd.read_csv(path)
/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py:2718: DtypeWarning:

Columns (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345) have mixed types. Specify dtype option on import or set low_memory=False.

In [7]:
df_bonus.head()
Out[7]:
Unnamed: 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 ... 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
0 forecast 1996-04-01 00:00:00 1996-05-01 00:00:00 1996-06-01 00:00:00 1996-07-01 00:00:00 1996-08-01 00:00:00 1996-09-01 00:00:00 1996-10-01 00:00:00 1996-11-01 00:00:00 1996-12-01 00:00:00 1997-01-01 00:00:00 1997-02-01 00:00:00 1997-03-01 00:00:00 1997-04-01 00:00:00 1997-05-01 00:00:00 1997-06-01 00:00:00 1997-07-01 00:00:00 1997-08-01 00:00:00 1997-09-01 00:00:00 1997-10-01 00:00:00 1997-11-01 00:00:00 1997-12-01 00:00:00 1998-01-01 00:00:00 1998-02-01 00:00:00 1998-03-01 00:00:00 1998-04-01 00:00:00 1998-05-01 00:00:00 1998-06-01 00:00:00 1998-07-01 00:00:00 1998-08-01 00:00:00 1998-09-01 00:00:00 1998-10-01 00:00:00 1998-11-01 00:00:00 1998-12-01 00:00:00 1999-01-01 00:00:00 1999-02-01 00:00:00 1999-03-01 00:00:00 1999-04-01 00:00:00 1999-05-01 00:00:00 1999-06-01 00:00:00 ... 2021-08-31 00:00:00 2021-09-30 00:00:00 2021-10-31 00:00:00 2021-11-30 00:00:00 2021-12-31 00:00:00 2022-01-31 00:00:00 2022-02-28 00:00:00 2022-03-31 00:00:00 2022-04-30 00:00:00 2022-05-31 00:00:00 2022-06-30 00:00:00 2022-07-31 00:00:00 2022-08-31 00:00:00 2022-09-30 00:00:00 2022-10-31 00:00:00 2022-11-30 00:00:00 2022-12-31 00:00:00 2023-01-31 00:00:00 2023-02-28 00:00:00 2023-03-31 00:00:00 2023-04-30 00:00:00 2023-05-31 00:00:00 2023-06-30 00:00:00 2023-07-31 00:00:00 2023-08-31 00:00:00 2023-09-30 00:00:00 2023-10-31 00:00:00 2023-11-30 00:00:00 2023-12-31 00:00:00 2024-01-31 00:00:00 2024-02-29 00:00:00 2024-03-31 00:00:00 2024-04-30 00:00:00 2024-05-31 00:00:00 2024-06-30 00:00:00 2024-07-31 00:00:00 2024-08-31 00:00:00 2024-09-30 00:00:00 2024-10-31 00:00:00 2024-11-30 00:00:00
1 00501 143407.57612467572 143125.18210915907 142729.25700106422 142439.95876041506 142142.21205113904 141707.9573705128 141357.72011090795 140928.40101781333 140484.92878144854 140189.8221505217 139675.2000563344 139271.8860663343 138920.93288097635 138592.83804960945 138229.38419579086 137907.4119283976 137567.23066350466 137171.5828310024 136820.7960171212 136444.84329865538 136087.70015725127 135533.75724284642 135095.30354585132 134789.59517472467 134434.14287042766 134060.04955661076 133728.96522802007 133373.66817322295 132992.13816822882 132636.15286284446 132285.33349988368 131962.75860129786 131687.60492633205 130874.97546271485 130517.05829611766 130308.85260369224 129947.14762332248 129526.80437347744 129227.97396411776 ... 109038.89500881603 109422.61682996622 110015.7268954241 110692.10181210077 109863.17965539932 110528.9191270307 111294.18375675447 111659.47340520911 111831.2463898708 112384.64555564779 112622.41955822859 112843.53694657539 113412.3124424299 113797.70406496884 114443.43047320515 115184.17232456435 114099.73174394573 114862.98751665946 115723.8174354118 116075.83537608312 116200.83359439988 116785.89265442752 116987.82845101133 117173.6747709056 117786.81816107851 118174.20981406793 118872.16554292938 119672.83872340331 118334.30829456268 119199.16597737193 119971.37156573881 120357.95145781846 120623.05218785605 121112.64135684574 121420.8351453208 121716.34191539131 122198.99933267945 122581.42040950274 123121.6046025834 123729.1818081638
2 00544 63290.16879725616 63260.94360276103 63480.36532086383 63775.799661121775 64237.09906986853 64104.24279536816 63622.590989921926 63394.34602213741 63660.95034850707 64262.611530332724 64719.562058163225 64176.556382500145 64378.09732295869 64450.42869851107 64606.68034425301 64780.91078033191 65005.686255418426 64996.959979810905 64851.32124226298 64658.86933088041 64813.547915256844 65187.94667734188 65401.710145923564 65394.39925220043 65468.02014226543 65639.17736598571 65728.25617163956 65779.68592615076 65773.41276432782 65897.52043363336 66086.912466764 65922.63788783942 65958.61807035845 66105.27707838287 66085.93043577964 66618.87598759728 66559.78493149027 66826.96205903907 66844.9642194256 ... 93665.25193452332 94924.9646838192 94877.0513974353 94594.42131263699 94137.06722703911 93559.44803627912 95805.14063500699 95397.63698464373 96011.26214846106 95872.10858368274 95497.45628248152 94705.17326016707 95522.2048179351 97108.28780527734 97057.28863075725 96631.18516054087 95947.84734457906 95179.5330463768 97977.4842091862 97418.22336295061 98116.03652924237 97891.32594288127 97389.81243038457 96397.53162463426 97387.900827484 99297.02377693662 99234.99681000171 98659.86660950241 97751.89060567817 96803.9193982436 99352.74023415329 99234.54596469976 99670.73739727537 99692.26284339905 99570.21076985738 99197.69322129167 99691.23826366974 100621.71221282297 100568.97838896512 100424.00037024656
3 00601 29111.920044151026 29995.868481088663 30855.959014864933 31839.530691197448 32257.789947809746 32485.69046492484 32497.509423201835 33237.57089611074 34317.40526196092 35496.35875961095 36164.40428667903 35910.07271511611 36539.677197232966 37228.513200703084 37917.70970032226 38658.51617002282 39196.606973139176 39642.33493678087 40008.33007437491 40645.81056810327 41415.85084815942 42252.74200668233 42883.89914544973 43445.45848555638 43964.7959263033 44452.05161815932 44970.23080391153 45476.20967483224 46143.51115918498 46810.55918591634 47522.81974538046 48045.95619805577 48501.327097440124 49003.3897551847 49613.67610825407 50991.08816793664 51386.77268242881 51666.323615943606 52013.69674447292 ... 167360.73698808733 169050.21285090732 169151.47658637792 168629.83005609785 168165.85373954484 168799.3035710555 172604.45805977855 172539.53012632972 172153.48331190573 171983.3479288125 171626.1950524174 172890.784174932 174460.21674101465 176459.66102032343 176401.06417103275 175550.9023850821 174785.6839061068 175461.54817489668 180071.57896824667 179829.92999495487 179215.38393289022 178878.60901518047 178330.79954333245 179768.60176854575 181570.67553155986 183869.93912106397 183640.59438506814 182459.90221845143 181402.9166865535 182136.6769746008 185821.36242744714 186070.3417414022 186127.04440573638 186294.46759699943 186346.49744263449 187289.97195676263 188398.83302498588 189768.6028282861 190018.62182935566 189822.89149110735
4 00602 76054.54828040714 75995.97998929964 75995.31291642178 75870.85919047637 75537.39475679093 75364.80281671108 75278.64519952443 75442.35366436705 75423.97218063675 75297.19985070902 75076.83451145887 75066.52490767298 74946.89588827573 74847.60312826668 74754.55366680495 74628.412143718 74450.0264933767 74332.4170957104 74246.41876542126 74221.12721387035 74122.08695151763 74136.41025176062 74009.90794642894 73968.85899696498 73837.38787261395 73696.48185455294 73512.55742410017 73389.17229759539 73366.82171306571 73301.04546538276 73210.31570946952 72995.24455982159 72821.16210438171 72979.74315438238 72945.23443736663 72870.2575141577 72725.96689479647 72542.65449513173 72269.47877666577 ... 76335.81432630375 76472.92286060563 75966.13047602121 75872.47176641827 76760.85233961749 77269.52830959077 77326.49212063556 77418.12310139617 77374.61648824406 77124.37733509892 77326.53672177937 78213.62968265571 78601.48933194901 78714.91399512843 78017.68251404946 77872.43527232227 78915.9099076532 79507.69972256666 79518.11377771481 79593.43181003621 79505.32233796314 79173.41771466586 79399.93379824376 80444.76225071165 80867.2326487611 80952.43230798053 80065.21236330793 79874.43419294621 81075.2326652098 81747.58268919335 81551.43619327525 81673.22668462936 81717.62296582351 81636.77090154926 81802.91176376949 82374.52112788711 82682.38075347786 82838.54452812675 82522.39591558947 82486.31634632402

5 rows × 346 columns

In [0]: