hpc-montecarlo

Google Cloud Datalab notebook for analysis of montecarlo stock portfolio tutorial. See URL for detailed tutorial.

In this notebook, we will load the simulation data from bigquery, then do some simple analysis. The first step is to load the bigquery python package into the notebook, and then connect to bigquery to extract the aggregate portfolio data.


In [6]:
%load_ext google.cloud.bigquery


The google.cloud.bigquery extension is already loaded. To reload it, use:
  %reload_ext google.cloud.bigquery

In [141]:
%%bigquery df
SELECT *
FROM `montecarlo_outputs.portfolio`


Out[141]:
f0_ f1_ f2_ f3_ f4_ f5_ f6_ f7_ f8_ f9_ ... f242_ f243_ f244_ f245_ f246_ f247_ f248_ f249_ f250_ f251_
0 2955.03 2969.054178 2958.858328 2939.327338 2962.537456 2942.212633 2994.162931 3018.529583 3064.931565 3092.980978 ... 24133.565635 24318.784862 24919.937276 26080.375775 26382.108628 26951.380606 26998.276629 28013.944572 28991.776491 29398.576209
1 2955.03 2950.708205 2979.031343 2969.418372 2986.003244 3005.570277 2986.801920 2959.814956 2895.178385 2891.564475 ... 21889.496871 21847.851179 22288.500800 21866.833447 22248.416493 22313.243473 22414.118274 22655.784208 22942.250565 23143.490689
2 2955.03 2969.043635 3018.477690 2985.753521 2998.672006 2992.430808 3018.022955 2994.083812 3002.362226 3029.258453 ... 20459.387384 20756.460443 20388.920379 20882.875407 21087.545866 20994.435321 21579.983537 21469.772176 21261.040568 20878.099125
3 2955.03 2947.140453 2944.277831 2890.958666 2846.406022 2866.933959 2869.320890 2873.983469 2875.711859 2828.795914 ... 32740.585977 33639.760415 35109.513330 36342.397107 37041.921150 37764.310496 37797.329322 38944.863008 39522.882136 38821.503869
4 2955.03 2891.032419 2913.423632 2972.159059 2949.392290 2919.901467 2911.040644 2947.047173 2982.638848 2970.722173 ... 22737.369605 22749.377230 23538.875129 23503.973504 24296.342335 24745.742837 24908.674910 25604.239324 26465.510772 27863.982357
5 2955.03 2991.559142 3030.418527 2985.717138 3016.088825 3077.875612 3090.314468 3123.374138 3106.093809 3158.307304 ... 16440.309950 16637.386745 16200.094632 16515.598158 17283.676334 17919.107710 18445.400496 18179.749849 18441.047543 18734.979616
6 2955.03 3002.698587 3031.495714 3045.467209 3028.297868 3043.960988 3033.042468 3089.800166 3095.863248 3105.348750 ... 37254.983752 37418.720010 38003.233177 39007.272680 39059.200462 39150.395305 41452.723342 42277.343967 42026.654595 43419.094859
7 2955.03 3007.778624 3049.232520 3098.478278 3141.016604 3158.131039 3105.432431 3112.774037 3173.707333 3197.448739 ... 32824.510720 33601.546549 33681.087232 33412.304895 33113.832902 33903.885223 35116.799997 35515.482774 35118.392944 35963.479792
8 2955.03 2958.650048 3005.011667 3027.995061 3086.446868 3058.800689 3116.445396 3118.975806 3097.814610 3087.013177 ... 27339.640101 28310.792935 28957.630854 29748.509617 29986.588826 30157.064164 30810.625727 30364.188156 30876.465702 32586.459814
9 2955.03 2933.478718 2959.303112 3002.142338 2973.726775 2965.199904 2913.288539 2926.240242 2931.073347 3015.281702 ... 25160.853322 24806.289831 25721.522007 26915.114176 27693.257681 28178.890721 29248.719346 28843.336624 29483.685998 29182.667884
10 2955.03 2948.102421 2975.301531 2947.713149 3015.133098 3018.508309 3024.617589 3082.283411 3075.039524 3063.827705 ... 27810.747154 27621.132056 28792.868047 28837.993356 29468.464141 30185.076309 30056.629992 31120.332978 32032.992107 32185.962390
11 2955.03 2970.284719 3005.550707 2963.929209 3006.477196 3015.694539 2986.641578 2995.509304 2979.821357 2949.059370 ... 26300.750180 26181.215119 27027.152297 28396.483563 28709.835266 30102.430695 29967.198418 30025.831478 30610.414276 33126.883325
12 2955.03 2951.181660 2891.244540 2857.980966 2809.013110 2815.171543 2803.699434 2885.329371 2853.616106 2892.477092 ... 13361.733750 13932.916138 13716.631745 13933.823376 13933.567451 13967.049787 14478.522966 15024.221906 15430.398696 15972.859700
13 2955.03 2987.754941 2949.102564 3008.970995 3052.589347 3061.330766 3088.166471 3117.182457 3174.076459 3211.602745 ... 35101.064897 35435.217744 34977.225080 36110.453645 36261.149698 37661.339714 38361.275057 39494.714097 40286.716230 41859.300931
14 2955.03 3031.462835 3033.056897 3059.390892 3062.729780 3102.121722 3129.843861 3151.393473 3166.136903 3148.267018 ... 21981.451785 22547.540740 22439.181698 23676.371082 23495.762002 24577.063442 25033.108762 25892.660201 25454.769462 25050.650756
15 2955.03 3001.010066 3035.169463 3038.167477 3066.427016 3125.764469 3149.293653 3232.549320 3287.173575 3329.683470 ... 25728.827727 26427.932854 26219.470182 26833.126812 27656.685430 27758.236351 28441.981671 28817.388261 30391.640841 30721.970307
16 2955.03 2980.086819 2972.250029 2939.141320 2940.182191 2938.666745 2940.057093 2948.231315 2897.120923 2904.605911 ... 18626.720241 18737.189592 19063.976304 19190.896114 19818.742692 20255.816265 21359.574335 21148.922721 21334.161328 20885.452059
17 2955.03 3011.756642 3023.600633 3030.727847 2977.502277 3030.002203 3062.476787 3089.221586 3143.263803 3135.549004 ... 26374.138541 26014.156774 26001.551939 26662.899285 27318.785537 28250.138893 28546.266333 29531.524185 28971.717036 29217.348013
18 2955.03 2977.824991 2989.465557 2977.456967 2999.928948 3014.551362 3035.763802 3042.105082 2989.849627 3004.913097 ... 16848.169821 16714.987886 16961.431040 17167.414241 17387.117198 17667.428425 18192.269909 18869.908421 18804.086190 18841.513763
19 2955.03 2942.593351 2989.037882 3057.719480 3077.889630 3130.891990 3075.581437 3128.838614 3150.194568 3152.215587 ... 23878.502015 24369.850319 24947.370980 24766.346662 24720.461215 25341.632822 26110.025633 26162.690801 26418.404103 25512.652821
20 2955.03 2971.771125 3005.376779 2981.844516 3045.185952 3080.023577 3067.551566 3021.502255 3064.836436 3129.788859 ... 24538.599041 24390.361757 25494.467898 25522.932136 26575.597177 26385.896244 25656.773415 26337.528093 26787.153693 26941.073359
21 2955.03 3030.033055 3055.910016 3108.716504 3094.029109 3098.194730 3065.248975 3088.395489 3128.225368 3077.100911 ... 20501.980024 20856.977248 21061.414502 21537.276817 21452.436212 22184.739781 22756.071826 23113.071653 22976.222324 22632.196833
22 2955.03 2948.964992 3032.357374 3050.551502 3094.634988 3155.821703 3171.471625 3182.860367 3142.426846 3189.377111 ... 18057.920454 18054.322316 18584.615099 18658.619518 19177.618534 19193.502912 19577.094153 19803.400938 20160.861189 19905.795529
23 2955.03 3033.973006 3012.224122 3073.995917 3083.744228 3128.023905 3179.726846 3232.633810 3245.813162 3250.508690 ... 18480.307364 18338.099253 18855.274801 19275.220035 19775.072237 20076.945245 20274.972547 20585.998118 21430.093905 21824.344643
24 2955.03 2979.796314 2995.258315 3018.396675 3029.471685 3034.037054 3046.036986 3036.978886 3086.494116 3082.709456 ... 22669.449059 22320.533016 22694.567026 21952.144123 22134.820617 22763.660905 22912.238735 23093.377479 22958.219570 23215.853880
25 2955.03 2921.410991 2929.833498 2931.414953 2916.925368 2986.382078 3070.033209 3062.312563 3057.594280 3060.095059 ... 19127.948964 18806.457929 18843.542635 19007.219467 19528.728623 19332.953558 19719.046215 19944.115484 19715.736199 19754.342975
26 2955.03 3008.466318 3058.638306 2984.873086 2920.506292 2924.989381 2913.310984 2946.539541 2973.204137 3006.413020 ... 46760.365408 47721.122912 48956.491510 49828.775604 49988.049248 50354.184855 50544.165136 50765.415046 51273.371921 52834.342197
27 2955.03 2926.277788 2908.574062 2898.718174 2869.003143 2939.418204 2980.501650 2992.760265 3004.808384 3042.358132 ... 20939.171589 21480.601882 21757.054837 22695.972179 23285.082260 22948.473441 23255.412403 23188.029040 23806.430873 23523.252558
28 2955.03 3035.617694 3068.370285 3094.403960 3147.530937 3164.946117 3150.318755 3205.970872 3210.348605 3182.226052 ... 16237.862791 16124.577530 16490.687974 16706.901856 16573.104082 16827.074989 17050.597197 17039.630860 17188.480471 17562.130761
29 2955.03 2954.833954 2919.889013 2884.037456 2901.591278 2897.788488 2901.102997 2930.420898 2939.641700 2930.252911 ... 29056.773805 29092.711415 30210.726380 31242.568422 30727.069712 29230.887155 29337.778624 30088.122889 30246.312069 30548.145231
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
970 2955.03 2928.571482 2901.553674 2893.203454 2896.577242 2921.097162 2904.229459 2950.720582 2989.506114 3015.744364 ... 23997.725868 24506.789450 24874.707295 25162.246948 26055.308793 26335.470436 27510.454557 29051.947559 29840.614778 29995.605149
971 2955.03 2936.863701 2971.942530 2966.972152 2983.475823 2989.483580 2961.844430 2947.125023 2922.321590 2933.011279 ... 16854.020737 17284.789784 17041.276812 17181.501709 17635.953894 17694.876647 17535.736303 17735.783602 17796.276815 17704.561570
972 2955.03 2937.491071 2929.328609 2973.833199 2942.139320 2942.152307 2947.847175 3018.366248 3011.451292 3027.100259 ... 18037.792079 18171.124848 17994.216517 17623.866964 18337.994086 18519.610628 19215.196490 19459.786283 20184.863035 20871.004478
973 2955.03 2996.808847 2991.348863 3025.894368 3005.836565 3069.803320 3144.563685 3104.423989 3165.377384 3185.283219 ... 34251.777707 34309.128611 35876.364469 37048.995095 37609.618005 37669.660411 38434.954995 39990.661548 39949.567223 40074.486168
974 2955.03 2978.017085 2943.572423 2936.330576 2939.820270 2930.770079 2918.092556 2900.546966 2954.604719 3009.280953 ... 13520.360040 13279.458548 13086.883483 13062.075319 12851.591611 13269.893500 13710.973211 14187.194415 14477.156426 14657.185583
975 2955.03 2971.060287 2916.687274 2896.628956 2887.216322 2861.546793 2852.065683 2803.726932 2809.524935 2820.009173 ... 17798.161206 17765.085231 17430.964266 18061.786962 18110.581869 18693.683009 19106.991798 18839.757161 18806.379846 19108.168368
976 2955.03 3026.511399 3060.124844 3053.246266 3089.607408 3169.095857 3218.969498 3147.086951 3186.984168 3282.800057 ... 19854.615284 20738.487538 21311.919648 21663.481073 21630.391581 22110.364596 23135.278928 23443.856215 24004.697163 24504.176637
977 2955.03 2913.229824 2899.581027 2905.520331 2930.459275 2966.489042 2983.062387 2985.157018 2968.951115 3031.627371 ... 14634.657002 14795.128666 15052.889751 15251.401782 15828.447859 16419.397993 16226.363857 16596.017788 16801.377816 17085.519418
978 2955.03 3003.100823 3011.395523 3018.728222 3009.499580 3091.729093 3141.235256 3147.857362 3101.380173 3100.672196 ... 21075.543966 20860.573557 21283.923042 21853.134371 22409.515861 22552.876119 23102.925883 23216.611015 23143.360764 22831.800548
979 2955.03 2943.668996 2962.419171 2887.098776 2938.088170 2948.866551 3066.190187 3047.147267 3124.221820 3166.947881 ... 26618.854713 27172.807325 27386.918680 28077.029405 28504.896134 28488.796242 27913.279652 29250.613728 29750.502044 29090.990846
980 2955.03 2975.512907 2974.920211 3006.584507 2998.344943 2968.236108 2970.512144 2968.430884 3016.712439 3069.010116 ... 22901.492164 23576.527256 24582.271217 24205.841621 24277.444116 25095.771161 24857.694600 25613.962868 25765.773939 26349.269493
981 2955.03 2906.442941 2967.397444 2986.533317 3021.066312 3031.396618 3036.697362 3028.399953 3064.643048 3083.574419 ... 19394.057348 19266.469645 19878.761965 19986.202121 20413.287565 20605.769418 20246.238976 20298.389657 21153.762645 21565.975817
982 2955.03 2977.110547 2958.783461 3011.933119 3056.315641 3085.306107 3102.935976 3042.877569 2990.775104 3029.659430 ... 26385.090139 26431.256455 25892.816320 26017.429365 25867.510862 26489.149573 26699.536335 27276.707362 27994.965355 27947.573452
983 2955.03 2966.241014 2983.238137 2991.172712 3040.563449 3066.759908 3101.931841 3125.356411 3124.544668 3106.132622 ... 17967.542480 18811.403782 19652.160631 19220.505488 19107.429324 19860.303506 20422.280754 20599.622392 20880.454766 20359.308699
984 2955.03 3021.183221 3081.764282 3117.409577 3062.109487 3087.092196 3145.721668 3171.617779 3158.857076 3131.700544 ... 11257.039597 11351.229210 11657.093450 11947.526104 11980.798311 11694.243143 12024.179997 12200.191843 12442.573373 12940.482656
985 2955.03 2938.907146 2947.281620 2962.619221 3006.050066 3026.037607 3092.829726 3123.841094 3123.775374 3165.260702 ... 27844.440309 28164.160294 28048.017167 27933.160142 28428.091003 28649.321270 28576.496003 29335.961723 28984.567873 28970.421471
986 2955.03 3001.064607 2940.888783 2942.683648 2913.216129 2911.535953 2929.495709 2953.441478 2946.977474 2952.414088 ... 27625.657981 27529.215770 27782.957660 27672.554237 27615.621151 27723.960061 29011.902252 29977.923000 30964.392734 30595.633996
987 2955.03 2948.884647 2874.081792 2826.472417 2868.897832 2902.221352 2938.940731 2945.564729 2982.636577 2936.203958 ... 30783.378567 31016.655990 32199.426977 30511.720904 32111.878831 31846.924994 32131.997944 33223.106773 31888.633790 32206.816012
988 2955.03 2964.693079 2979.037367 2981.510534 2940.126761 2895.102541 2897.115940 2937.659140 2866.985746 2891.989894 ... 16735.503368 17042.515428 17228.390209 17651.677779 18071.130485 18321.770186 18364.155224 18423.413273 18112.060240 18186.379094
989 2955.03 2954.404917 2923.786530 2942.215502 2945.818071 2986.235526 3007.589237 3005.747205 3016.832137 3022.209142 ... 18078.569376 18006.828487 17888.115458 18408.764624 18429.158789 18236.417216 17698.658786 18049.424930 18417.992251 18713.381425
990 2955.03 2942.320585 2954.344317 2968.016812 3044.836416 3073.761342 3126.127654 3091.656130 3071.986693 3087.338850 ... 17226.233036 17084.188883 17223.277174 17056.163846 17137.168669 17764.823763 17677.814386 17844.795921 18244.604156 18161.140219
991 2955.03 2984.263437 2995.946160 3048.776791 3094.794712 3098.478524 3113.820955 3094.024230 3107.622284 3104.552660 ... 20023.606253 19869.640984 20569.375882 20619.247649 20843.781382 20991.579427 20626.362769 21455.432950 21463.869477 21775.578864
992 2955.03 2992.526359 3052.627035 3097.224282 3062.907823 3140.580380 3220.264515 3222.937163 3210.547219 3243.020601 ... 35059.987704 36165.067489 36967.294630 38182.030200 39403.549211 38872.110356 40309.437255 40283.602976 40876.000230 39912.067572
993 2955.03 2986.343620 3028.023620 3020.305295 3033.370487 3094.012208 3054.888753 3071.798838 3092.265860 3074.650807 ... 33626.680431 33886.515261 34511.658718 35236.445975 35435.869529 35417.487195 36746.274713 38036.898945 38502.772881 37764.025190
994 2955.03 2934.406227 2946.312366 2991.433435 3030.662270 3083.824713 3129.687373 3148.151258 3173.160321 3103.053792 ... 27362.966781 27744.820951 28853.510680 28762.350361 29981.690200 29864.646558 29316.290455 28755.896323 29099.703272 29195.676417
995 2955.03 2926.255646 2968.959642 2900.490130 2915.941364 2869.378360 2907.049147 2860.396941 2927.998232 2948.079837 ... 31253.695858 29777.493934 29248.445192 29591.802144 29061.488802 29186.105190 30719.035599 31456.978505 32260.752104 32265.643702
996 2955.03 2927.752961 2905.991646 2923.388865 2906.162248 3011.776902 2981.144173 3031.681106 3032.911316 3042.139000 ... 27324.920780 27429.598618 27833.656684 27628.908933 28726.185036 31415.377987 31953.410752 32410.332140 32258.646779 34130.812020
997 2955.03 2907.457076 2864.184707 2864.929438 2848.121691 2863.446728 2865.338678 2864.657028 2866.242991 2849.620496 ... 17610.789092 17840.249592 18053.681093 18399.176048 18023.899206 17862.971193 18122.868930 18545.832714 18868.594302 19252.093010
998 2955.03 2926.236979 2988.800943 2992.622886 2968.751512 2967.529441 3014.691205 3036.258020 3053.508677 3040.491655 ... 24785.688756 25365.372972 26078.705510 26300.453442 26736.487294 27129.101952 27378.624882 26399.079635 27469.832849 26655.755731
999 2955.03 3009.801850 2977.471767 2936.135747 2956.611400 2980.979875 3037.274024 3092.244949 3115.247853 3149.359561 ... 24236.354571 24185.309742 24495.748587 25624.733130 26332.542953 26306.473748 26383.627091 27271.397237 28268.842099 27847.730453

1000 rows × 252 columns

Now df contains portfolio as a pandas dataframe. Each row n represents a different simulation, and each column m represents the value of the portfolio m days into the simulation. Column 0 is the value of the portfolio before simulation, column 1 is the value after 1 day of simulation, and so on.

We can plot the divergence of the simulations over time and see the spread.


In [105]:
df.T.plot(legend=False)


Out[105]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fe555ef6978>
/usr/local/envs/py3env/lib/python3.5/site-packages/matplotlib/font_manager.py:1320: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans
  (prop.get_family(), self.defaultFamily[fontext]))

In [165]:
import matplotlib.pyplot as plt

mean = df.mean().reset_index().iloc[:,-1]
std  = df.std().reset_index().iloc[:,-1]
plt.errorbar(mean.index, mean, xerr=0.5, yerr=2*std, linestyle='-')
plt.show()


While this shows the general progression, we might be interested in the spread of values at the end of the simulations, day 252. Looking at this day in particular, we plat a histogram of the values.


In [63]:
df.iloc[:,-1].hist(bins=100)


Out[63]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f931da89e48>

In [64]:
df.iloc[:,-1].describe()


Out[64]:
count     1000.000000
mean     27958.274051
std       9295.381959
min       9446.052887
25%      21106.335794
50%      26438.180608
75%      33112.044098
max      74756.152636
Name: f251_, dtype: float64

We can also load the individual stock simulations as opposed to the aggregate portfolio valuation. Loading the data into a second data frame, we can then take a look at each of the FANG stocks to see the progression over the 1000 simulations.


In [13]:
%%bigquery df2
SELECT *
FROM `montecarlo_outputs.vartable`


Out[13]:
string_field_0 int64_field_1 int64_field_2 double_field_3 double_field_4 double_field_5 double_field_6 double_field_7 double_field_8 double_field_9 ... double_field_246 double_field_247 double_field_248 double_field_249 double_field_250 double_field_251 double_field_252 double_field_253 double_field_254 double_field_255
0 FB 2410 0 152.19 144.905846 144.951172 142.749252 143.269165 142.594690 146.821937 ... 89.606392 89.177785 92.721928 94.522026 91.451523 91.042981 94.177538 94.206427 91.200201 93.657338
1 FB 2410 1 152.19 152.425043 157.150582 157.506708 159.662221 161.801032 153.262579 ... 60.808219 59.418792 58.933333 58.820547 57.606162 56.208928 54.603471 54.851866 53.232080 54.959868
2 FB 2410 2 152.19 151.677866 151.489566 152.819220 146.971852 148.378325 145.464370 ... 196.188171 208.039583 209.094241 200.698370 203.292706 202.000613 193.434698 193.202570 189.096496 195.342309
3 FB 2410 3 152.19 150.445516 151.905515 150.441929 145.128322 149.626819 150.603106 ... 83.293668 81.075901 79.486812 78.081918 79.386557 77.282347 79.287460 79.242839 79.246359 81.212200
4 FB 2410 4 152.19 145.485561 139.690635 138.331711 131.535753 129.032230 126.768496 ... 51.211104 52.797385 51.371034 50.198716 49.938387 49.508197 48.624708 48.893717 48.093533 49.037524
5 FB 2410 5 152.19 150.926539 148.605474 150.917185 150.151479 149.199300 144.801924 ... 69.347886 72.130507 72.205711 71.709342 73.033451 71.271345 69.843855 68.242521 67.288115 66.658413
6 FB 2410 6 152.19 145.659339 139.744537 139.062105 137.884794 141.655337 142.420351 ... 82.911678 82.424948 84.519843 87.036998 86.054190 86.999170 88.731084 89.976490 88.976558 87.168492
7 FB 2410 7 152.19 149.709912 147.067371 145.081747 141.231673 138.993851 139.123350 ... 177.767643 177.998859 173.648577 178.770341 174.177270 173.650900 170.394817 166.693643 172.527401 176.288891
8 FB 2410 8 152.19 158.881968 163.116787 159.661271 158.777866 164.299003 162.532402 ... 118.122238 118.383675 121.651653 123.973182 126.149386 125.075431 126.814592 128.474181 126.028583 123.222751
9 FB 2410 9 152.19 147.680457 144.597714 143.011350 147.301939 146.468620 148.665525 ... 77.096506 77.445335 77.671710 79.268693 78.967390 78.212094 77.827591 76.468421 77.587922 78.685890
10 FB 2410 10 152.19 147.236465 146.492540 142.981883 143.855610 149.609327 147.223572 ... 70.432954 70.856623 71.965696 71.202508 72.222757 71.658664 69.919457 70.878551 69.371294 67.638804
11 FB 2410 11 152.19 155.921120 157.384621 154.634323 153.567112 155.168963 161.993068 ... 110.435208 112.271033 113.619455 111.640161 109.205649 106.921261 107.492813 106.056660 106.185429 110.338856
12 FB 2410 12 152.19 148.388471 153.269795 157.574019 153.813486 148.238001 145.340732 ... 76.904138 78.038147 79.811565 81.257851 81.121715 78.709399 82.327782 79.882510 80.314215 81.993288
13 FB 2410 13 152.19 150.272355 147.559696 143.201464 144.494025 142.649552 138.144664 ... 76.026886 73.949976 73.702787 73.954957 73.369020 70.357322 67.970136 65.707866 66.104469 67.780220
14 FB 2410 14 152.19 147.482706 144.407998 147.297376 144.896649 142.437309 141.200672 ... 47.360698 48.182876 50.078308 50.449088 51.241328 51.054741 50.555576 49.483474 49.959267 49.830932
15 FB 2410 15 152.19 151.246911 151.021456 152.690052 154.298993 154.143613 151.361528 ... 124.963197 125.181307 126.500980 125.412868 127.585479 122.928744 124.123103 126.123480 129.772033 132.771861
16 FB 2410 16 152.19 155.738197 156.257891 158.198159 155.170974 149.563235 146.845680 ... 92.159044 92.879475 92.404149 89.401473 91.884015 90.607711 91.475860 89.070110 84.476073 84.264844
17 FB 2410 17 152.19 153.970172 152.667072 156.171460 161.859306 157.157533 163.604572 ... 124.144461 118.478897 114.529561 116.070275 115.224503 116.188505 115.871314 119.255483 115.389734 116.077695
18 FB 2410 18 152.19 153.404224 152.224329 148.393127 147.285438 151.376233 154.184843 ... 92.983364 91.746209 91.840536 91.841263 92.595173 94.383514 95.221800 95.340481 92.291290 93.007549
19 FB 2410 19 152.19 145.800368 142.537908 142.417156 141.088855 143.727688 140.888659 ... 63.252958 63.110556 63.886230 65.386959 64.290072 62.914436 62.784062 62.518954 62.405691 60.881630
20 FB 2410 20 152.19 152.833904 150.935223 150.358230 157.259832 152.844648 149.480116 ... 80.515427 80.226483 78.419092 78.696261 79.173101 79.927047 80.145645 79.799507 81.560383 83.338307
21 FB 2410 21 152.19 152.515679 153.045833 157.193878 158.393077 165.185964 167.339219 ... 87.201103 88.044515 91.998203 90.659132 90.938938 88.964557 90.141183 92.124667 91.171060 91.554965
22 FB 2410 22 152.19 153.359932 155.027263 151.164221 147.340910 148.404972 143.424526 ... 99.946374 99.715417 98.773756 97.061172 96.184174 97.358438 97.339731 96.426987 95.682482 99.429415
23 FB 2410 23 152.19 151.464880 152.254210 156.236956 158.063597 159.289065 158.248291 ... 106.302507 106.221468 104.181468 105.714676 108.133002 104.939538 105.488548 104.059445 103.913015 104.724577
24 FB 2410 24 152.19 155.432739 157.660377 160.588204 159.569804 155.147650 160.075594 ... 82.409735 77.564064 77.444252 76.082021 76.482537 77.066720 76.930037 77.823213 79.722594 77.729430
25 FB 2410 25 152.19 153.511589 151.383835 152.032698 150.689130 147.009632 148.869567 ... 94.627657 92.531969 93.372732 90.613618 88.414560 87.001523 88.433073 86.988349 86.875075 86.097537
26 FB 2410 26 152.19 150.116182 145.934654 142.178890 144.742045 145.198294 143.189636 ... 66.790587 65.075422 63.251936 65.190079 65.501520 67.439780 66.871307 67.788949 67.976895 68.825342
27 FB 2410 27 152.19 153.083615 158.903122 158.332020 158.195446 161.647545 161.126182 ... 71.385631 72.439665 70.368490 70.358074 70.507406 70.689234 71.861957 72.182803 72.768353 71.901615
28 FB 2410 28 152.19 152.718125 152.206901 148.963180 149.636026 146.810504 148.654407 ... 80.784922 81.678452 78.520253 76.455253 73.057848 72.259153 72.100099 74.620167 75.562488 76.991252
29 FB 2410 29 152.19 154.677047 152.931325 148.838620 147.538428 149.355035 147.290230 ... 42.826243 42.774531 41.796562 41.742561 42.211818 43.745637 45.377420 45.477676 45.704991 43.525000
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
3970 AMZN 5010 970 1497.05 1482.836053 1509.764923 1508.216133 1519.565884 1508.587130 1527.439921 ... 6226.833863 6282.799888 6214.781888 6110.858316 6164.529101 5987.164536 5943.419950 6002.678721 6057.265555 5902.534440
3971 AMZN 5010 971 1497.05 1512.435344 1557.531153 1542.318435 1576.722997 1561.394625 1573.637540 ... 5072.392169 5145.701276 4989.308775 4901.745484 4737.524627 4641.744624 4595.887812 4582.826889 4607.825089 4562.342968
3972 AMZN 5010 972 1497.05 1512.075042 1507.182469 1540.304385 1556.509658 1583.875797 1573.053114 ... 7632.860193 7638.667270 7732.640106 7672.790815 7609.983004 7786.958936 7779.961904 7409.397800 7653.847450 7681.856955
3973 AMZN 5010 973 1497.05 1493.000144 1524.241616 1529.171383 1535.985024 1492.854969 1495.925356 ... 5870.000977 5837.787807 5743.788441 5876.388876 6067.568168 6114.800384 5955.235481 5904.670472 5945.791956 6022.634860
3974 AMZN 5010 974 1497.05 1539.421866 1551.317244 1519.861713 1550.414956 1586.691684 1598.746245 ... 5685.647353 5665.187827 5727.064974 5772.326425 5689.062690 5618.298396 5603.665603 5693.967760 5684.021752 5605.545476
3975 AMZN 5010 975 1497.05 1510.662756 1497.902058 1503.793731 1474.967670 1456.396078 1451.362453 ... 5764.208783 5811.694361 5981.601029 5954.847271 5936.387951 5962.454878 5922.133363 6036.039583 6220.775510 6528.896048
3976 AMZN 5010 976 1497.05 1454.318493 1467.361326 1484.037723 1491.690601 1536.624813 1511.028730 ... 9264.662831 9422.668068 9358.698214 9495.773199 9387.330487 9671.171419 9843.290287 10051.334982 10059.778014 10174.996176
3977 AMZN 5010 977 1497.05 1513.502801 1483.895895 1495.706590 1495.264124 1513.862608 1492.041147 ... 6719.904639 6853.989028 7076.785970 6961.735429 6730.830849 6742.893341 6739.287910 6735.790437 6902.715942 6879.423229
3978 AMZN 5010 978 1497.05 1504.243564 1456.410393 1487.704856 1473.837242 1482.076928 1465.511036 ... 4140.465859 4135.783464 4188.989092 4256.258015 4317.901859 4366.660499 4357.048014 4363.122605 4407.657931 4330.725593
3979 AMZN 5010 979 1497.05 1498.192066 1501.168278 1529.148656 1528.512451 1502.901741 1521.217580 ... 7469.161335 7685.661107 7911.720247 7929.996249 8313.086424 8322.900071 8373.759624 8209.931462 8149.489180 7946.122830
3980 AMZN 5010 980 1497.05 1508.642516 1527.912559 1530.400764 1537.146530 1522.249278 1568.987887 ... 8452.071511 8402.265522 8200.918064 8194.117252 8111.146905 8190.971809 8184.681335 8382.449908 8226.577739 8491.475502
3981 AMZN 5010 981 1497.05 1509.416270 1548.336619 1557.033915 1619.978862 1666.192080 1651.265185 ... 5307.901044 5657.561444 5648.777081 5688.960054 5727.584867 5796.888734 5893.420793 5942.655002 6038.151551 6203.198161
3982 AMZN 5010 982 1497.05 1520.717641 1515.951512 1542.694699 1514.311093 1491.168642 1502.535310 ... 7769.663022 8000.011961 8128.146873 8457.441657 8177.244022 8178.817173 8308.324082 8352.265858 8363.428294 8604.817959
3983 AMZN 5010 983 1497.05 1513.972903 1514.263953 1557.245069 1579.797815 1589.698985 1607.412725 ... 10019.541166 10100.124593 10239.849918 10202.379734 10376.205601 10453.114892 10260.626404 10161.790517 10251.720676 10294.993990
3984 AMZN 5010 984 1497.05 1558.521836 1561.401095 1583.895246 1599.410821 1606.920116 1593.226700 ... 8812.903559 9059.527368 9267.253084 9438.887616 9548.743960 9729.779093 9925.292575 9895.168277 9908.047764 9572.001822
3985 AMZN 5010 985 1497.05 1542.008882 1553.629657 1591.587164 1600.023080 1673.807812 1714.436328 ... 6754.895048 6975.318235 6911.970728 6849.770577 6833.759218 6964.278644 6989.464440 6967.801337 6770.218052 6749.340949
3986 AMZN 5010 986 1497.05 1528.797131 1522.594452 1548.749285 1593.123169 1604.633560 1596.353811 ... 8486.473571 8431.044451 8548.151547 8515.529230 8532.340295 8466.938139 8604.799161 8660.238098 8756.775191 8809.992089
3987 AMZN 5010 987 1497.05 1473.611374 1471.585784 1460.983274 1502.789094 1496.815759 1498.457479 ... 5394.030537 5391.671339 5404.497068 5425.831299 5523.573728 5435.991594 5584.740597 5564.787349 5474.769282 5556.295782
3988 AMZN 5010 988 1497.05 1489.018894 1505.633023 1546.946687 1531.400198 1543.296534 1570.092922 ... 7171.587639 7162.186354 7388.991298 7355.666493 7221.046537 7285.313214 7628.052171 7793.047662 7851.539498 7858.152305
3989 AMZN 5010 989 1497.05 1489.044942 1468.631894 1474.388102 1486.988402 1562.043341 1588.393723 ... 5474.459522 5538.678343 5694.283052 5782.945938 5682.044746 5862.578494 5806.568488 5818.335484 5839.712111 5994.509316
3990 AMZN 5010 990 1497.05 1531.896056 1564.665900 1574.404904 1627.551941 1626.215732 1631.996199 ... 6029.990480 6129.619855 6213.563476 6385.423943 6545.070551 6666.763974 6744.262769 6901.072699 6904.986961 7002.417243
3991 AMZN 5010 991 1497.05 1505.225357 1533.255018 1605.404368 1660.981749 1682.449969 1697.838850 ... 10499.222458 10919.921034 11079.288086 11601.559633 11468.979943 11514.998200 11504.974396 11388.042049 11117.257500 10916.096621
3992 AMZN 5010 992 1497.05 1487.281222 1460.893305 1454.581125 1472.097047 1436.852856 1448.991911 ... 4811.319559 4799.620141 4833.561832 4885.946118 4940.323663 4891.882070 4889.692779 5001.803727 5032.957011 5114.303725
3993 AMZN 5010 993 1497.05 1496.434922 1503.334013 1530.394799 1584.645953 1613.575873 1643.422436 ... 6952.329486 6966.680070 6919.537690 6862.370212 6849.443284 6603.719857 6585.661123 6898.025045 7052.101697 7275.217931
3994 AMZN 5010 994 1497.05 1493.464730 1470.335206 1469.214153 1484.715373 1484.659148 1478.535704 ... 6800.390126 6958.968375 7079.826457 7171.434104 7149.152692 7125.644446 7035.963353 6960.133822 7133.233543 7370.188663
3995 AMZN 5010 995 1497.05 1513.168075 1523.116286 1497.830738 1495.904197 1492.803192 1472.400753 ... 5936.999052 6199.628075 6283.658653 6481.448747 6712.719262 6779.237608 6922.910212 6878.795278 6900.519424 6842.830684
3996 AMZN 5010 996 1497.05 1463.574554 1467.450439 1489.983283 1443.389290 1447.900957 1423.593565 ... 6778.355913 6944.399188 6777.527123 6871.787015 7087.235711 7231.420777 7168.374208 7321.279825 7310.620547 7174.301302
3997 AMZN 5010 997 1497.05 1541.445224 1609.380155 1624.895176 1634.670945 1710.642586 1742.592769 ... 9264.700188 9107.749382 9002.034297 9362.646320 9445.777238 9334.826336 9563.103909 9715.431971 9676.536431 9559.089127
3998 AMZN 5010 998 1497.05 1494.393130 1440.738669 1444.542932 1425.637656 1443.106654 1493.425619 ... 4850.000748 4859.625716 4946.084712 4947.651225 5009.239759 5008.271956 5027.528486 5097.952369 5178.367305 5145.592812
3999 AMZN 5010 999 1497.05 1524.862463 1531.871080 1553.568087 1565.486641 1565.107332 1583.312638 ... 6945.084975 6969.942153 7035.001929 7205.026600 7063.360553 7127.826027 7245.485021 7454.898427 7890.579710 7909.477862

4000 rows × 256 columns


In [67]:
df2[df2.string_field_0 == 'FB'][1:10].T[3:].plot(legend=False)


Out[67]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f9310f88c18>

In case you get a lot of font warnings for matplotlib, use this to ignore them.


In [107]:
import warnings
warnings.filterwarnings("ignore")