In my Exploratory Data Analysis and Visualization Course we’ve been using RStudio for exploring and munging data. I’m used to doing this in Pandas and it sort of reminded me of IPython Notebook. One of the great things about RStudio is the ability to create Markdown files that include your code and whatever text you’d like to include.

So I looked into whether IPython notebook could export to Markdown and sure enough it does. Below is an example of exporting a df.head table.


Below I’m importing Pandas as pd, then reading a project-file csv.

Next, I’m setting the display options to max columns of 5200 (5200 is arbitrary number) as when you try to display a large dataframe sometimes it won’t display b/c it exceeds the defaut IPython Notebook settings.

Last, I used df.head(15) to show the first 15 records in the dataframe.

import pandas as pd

df = pd.read_csv('***/grid_sites.csv')

pd.options.display.max_columns = 5200
df.head(15)

And now we can see this fantastically styled html table:

gid x y g_point_elev10ft g_pointwaternearangle g_pointwaternearfeet g_pointwaternearmeters gr0050morigsqmtrs gr0050mlandsqmtrs gr0100morigsqmtrs gr0100mlandsqmtrs gr0250morigsqmtrs gr0250mlandsqmtrs gr0500morigsqmtrs gr0500mlandsqmtrs gr1000morigsqmtrs gr1000mlandsqmtrs gr0050mtreecsqmtrs gr0100mtreecsqmtrs gr0250mtreecsqmtrs gr0500mtreecsqmtrs gr1000mtreecsqmtrs gr0050mtreecpctorig gr0050mtreecpctland gr0100mtreecpctorig gr0100mtreecpctland gr0250mtreecpctorig gr0250mtreecpctland gr0500mtreecpctorig gr0500mtreecpctland gr1000mtreecpctorig gr1000mtreecpctland gr0050melev10ftcount gr0050melev10ftmin gr0050melev10ftmax gr0050melev10ftmean gr0050melev10ftstd gr0100melev10ftcount gr0100melev10ftmin gr0100melev10ftmax gr0100melev10ftmean gr0100melev10ftstd gr0250melev10ftcount gr0250melev10ftmin gr0250melev10ftmax gr0250melev10ftmean gr0250melev10ftstd gr0500melev10ftcount gr0500melev10ftmin gr0500melev10ftmax gr0500melev10ftmean gr0500melev10ftstd gr1000melev10ftcount gr1000melev10ftmin gr1000melev10ftmax gr1000melev10ftmean gr1000melev10ftstd gr0050mbldgvol gr0100mbldgvol gr0250mbldgvol gr0500mbldgvol gr1000mbldgvol gr0050mbldgbulkorig gr0050mbldgbulkland gr0100mbldgbulkorig gr0100mbldgbulkland gr0250mbldgbulkorig gr0250mbldgbulkland gr0500mbldgbulkorig gr0500mbldgbulkland gr1000mbldgbulkorig gr1000mbldgbulkland trafesrigr0050mavg_20012012 trafesrigr0100mavg_20012012 trafesrigr0250mavg_20012012 trafesrigr0500mavg_20012012 trafesrigr1000mavg_20012012 trafesrigr0050mavg_2001 trafesrigr0050mavg_2002 trafesrigr0050mavg_2003 trafesrigr0050mavg_2004 trafesrigr0050mavg_2005 trafesrigr0050mavg_2006 trafesrigr0050mavg_2007 trafesrigr0050mavg_2008 trafesrigr0050mavg_2009 trafesrigr0050mavg_2010 trafesrigr0100mavg_2001 trafesrigr0100mavg_2002 trafesrigr0100mavg_2003 trafesrigr0100mavg_2004 trafesrigr0100mavg_2005 trafesrigr0100mavg_2006 trafesrigr0100mavg_2007 trafesrigr0100mavg_2008 trafesrigr0100mavg_2009 trafesrigr0100mavg_2010 trafesrigr0100mavg_2011 trafesrigr0250mavg_2001 trafesrigr0250mavg_2002 trafesrigr0250mavg_2003 trafesrigr0250mavg_2004 trafesrigr0250mavg_2005 trafesrigr0250mavg_2006 trafesrigr0250mavg_2007 trafesrigr0250mavg_2008 trafesrigr0250mavg_2009 trafesrigr0250mavg_2010 trafesrigr0250mavg_2011 trafesrigr0500mavg_2001 trafesrigr0500mavg_2002 trafesrigr0500mavg_2003 trafesrigr0500mavg_2004 trafesrigr0500mavg_2005 trafesrigr0500mavg_2006 trafesrigr0500mavg_2007 trafesrigr0500mavg_2008 trafesrigr0500mavg_2009 trafesrigr0500mavg_2010 trafesrigr0500mavg_2011 trafesrigr1000mavg_2001 trafesrigr1000mavg_2002 trafesrigr1000mavg_2003 trafesrigr1000mavg_2004 trafesrigr1000mavg_2005 trafesrigr1000mavg_2006 trafesrigr1000mavg_2007 trafesrigr1000mavg_2008 trafesrigr1000mavg_2009 trafesrigr1000mavg_2010 trafesrigr1000mavg_2011 trafnysdgr0050mavg_2012 trafnysdgr0100mavg_2012 trafnysdgr0250mavg_2012 trafnysdgr0500mavg_2012 trafnysdgr1000mavg_2012
0 100001 913307.305588 122566.653211 -9999.000000 0.000000 0.000000 0.000000 7853.950214 0.000000 31415.800866 0.000000 196348.755435 0.000000 785395.021770 0.000000 3141580.087165 0.000000 0 3952.313778 48341.868204 141231.629924 451567.071377 0 0 0.125807 0.000000 0.246204 0.000000 0.179822 0.000000 0.143739 0.000000 0 0.00000 0.0000 0.0000 0.00000 0 0.000000 0.0000 0.0000 0.00000 0 0.000000 0.0000 0.0000 0.0000 0 0.000000 0.0000 0.0000 0.0000 0 0.000000 0.0000 0.0000 0.0000 0.000000 2619.499213 5729.645316 216666.220329 1245817.366172 0.000000 0.000000 0.083382 0.000000 0.029181 0.000000 0.275869 0.000000 0.396558 0.000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 292.0 5696.50 4057.00
1 100002 913307.305588 122894.737200 4.091254 0.000000 0.000000 0.000000 7853.950214 4002.041561 31415.800866 15455.731616 196348.755435 90498.329446 785395.021770 353746.383694 3141580.087165 1260083.346102 0 11093.497657 52914.680481 147391.944889 457270.916748 0 0 0.353118 0.717759 0.269493 0.584703 0.187666 0.416660 0.145554 0.362889 426 3.16432 11.9986 6.2407 1.26460 1663 2.982810 45.9997 15.5446 11.86370 9738 2.756890 70.9901 35.2858 18.8374 38074 1.999990 72.4902 38.7175 16.7106 135048 -0.571724 80.4000 37.6836 18.9316 0.000000 0.000000 19214.061323 288823.918864 1369388.218735 0.000000 0.000000 0.000000 0.000000 0.097857 0.212314 0.367744 0.816472 0.435892 1.086744 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 292.0 6115.75 5783.57
2 100003 913307.305588 123222.821190 8.551375 179.351037 43.298329 13.197331 7853.950214 6015.726344 31415.800866 19405.331167 196348.755435 100369.997473 785395.021770 367448.179604 3141580.087165 1286631.025189 0 11937.307201 53841.962447 146602.206918 465608.381325 0 0 0.379978 0.615156 0.274216 0.536435 0.186660 0.398974 0.148208 0.361882 650 2.96409 29.9936 10.3767 5.06838 2090 2.887080 60.9857 21.9326 16.67590 10810 2.000700 72.4902 42.3306 21.3647 39543 0.000003 72.4902 40.5070 16.1305 137879 -0.571724 81.3846 39.4516 18.8936 0.000000 1612.288123 45018.070029 338849.649981 1439584.329659 0.000000 0.000000 0.051321 0.083085 0.229276 0.448521 0.431438 0.922170 0.458236 1.118879 0 0 0 0 5921 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5921 0 0 0 292.0 6708.14 4420.55
3 100004 913307.305588 123550.905179 10.467310 -177.696901 32.267293 9.835071 7853.950214 5880.768441 31415.800866 19673.126953 196348.755435 107230.957454 785395.021770 369655.430725 3141580.087165 1304984.251624 0 9313.748868 50462.934751 138130.017630 456204.304060 0 0 0.296467 0.473425 0.257007 0.470600 0.175873 0.373672 0.145215 0.349586 633 5.00011 53.9978 21.2648 13.60150 2120 2.000090 70.4479 33.9770 22.38520 11545 2.000090 72.4902 45.0991 21.4402 39759 -0.567119 72.4902 42.1236 15.6252 139880 -0.571724 81.3846 40.9431 18.7664 0.000000 11215.466129 76477.878380 389016.150776 1512592.943686 0.000000 0.000000 0.357001 0.570091 0.389500 0.713207 0.495313 1.052375 0.481475 1.159089 0 0 0 0 3172 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3172 0 0 0 292.0 7112.80 4550.44
4 100005 913307.305588 123878.989169 11.947045 178.242903 15.812024 4.819505 7853.950217 5651.420356 31415.800871 19634.119037 196348.755450 107940.774628 785395.021798 364151.650975 3141580.087222 1309911.503914 0 7535.803044 41917.311165 135291.915465 444299.917319 0 0 0.239873 0.383812 0.213484 0.388336 0.172260 0.371526 0.141426 0.339183 604 2.70946 61.9994 26.3050 18.87760 2109 3.045360 71.9000 39.6832 22.90150 11625 2.000090 72.4902 44.4567 21.1206 39160 -0.056434 72.4902 43.0519 15.6687 140624 -0.571724 81.3846 42.2975 18.6839 4704.419334 18160.057948 104013.332977 402625.521712 1576349.809436 0.598988 0.832431 0.578055 0.924923 0.529738 0.963615 0.512641 1.105653 0.501770 1.203402 0 0 0 0 3172 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3172 0 0 0 6143.0 5107.80 4109.58
5 100006 913307.305588 124207.073158 22.624182 -161.923546 79.396129 24.199940 7853.950217 6739.007056 31415.800871 21095.434941 196348.755450 98147.310302 785395.021798 352720.347034 3141580.087222 1302774.674229 0 7337.596454 34502.720968 132850.848030 417494.587341 0 0 0.233564 0.347829 0.175722 0.351540 0.169152 0.376646 0.132893 0.320466 727 4.00088 46.7818 23.0326 11.08500 2267 2.000180 68.5309 29.1116 16.65140 10549 0.000003 72.4902 43.2480 20.4839 37924 0.000202 72.4902 44.0058 15.4997 140158 -0.056434 81.3846 43.4028 18.6851 6783.461332 24171.562636 115763.729527 407398.208171 1641226.048596 0.863701 1.006597 0.769408 1.145820 0.589582 1.179490 0.518718 1.155018 0.522421 1.259793 0 0 0 0 3172 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3172 0 0 0 4454.0 2856.00 5352.36
6 100007 913307.305588 124535.157148 8.151647 129.986839 14.512148 4.423303 7853.950216 4616.186123 31415.800869 15732.207012 196348.755442 82684.172200 785395.021784 336553.331833 3141580.087194 1285053.695475 0 5358.238357 30564.717464 120886.097773 395407.195670 0 0 0.170559 0.340590 0.155665 0.369656 0.153918 0.359189 0.125863 0.307697 499 3.99929 23.3207 12.2677 5.41508 1690 0.745061 43.2001 18.7173 9.72519 8867 -0.056434 71.9000 38.7254 18.6814 36192 -0.056434 72.4902 43.8062 15.9603 138169 -0.056434 81.3846 44.2498 18.7126 5773.110646 18733.478213 102679.547931 407044.663342 1642579.395792 0.735058 1.250623 0.596308 1.190772 0.522945 1.241828 0.518267 1.209451 0.522851 1.278218 0 0 0 0 3172 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3172 0 0 0 6143.0 3351.17 4777.50
7 100008 913307.305588 124863.241137 -9999.000000 0.000000 0.000000 0.000000 7853.950216 0.000000 31415.800869 0.000000 196348.755442 0.000000 785395.021784 0.000000 3141580.087194 0.000000 0 803.041086 27076.227876 104331.296215 381262.851315 0 0 0.025562 0.000000 0.137899 0.000000 0.132839 0.000000 0.121360 0.000000 0 0.00000 0.0000 0.0000 0.00000 0 0.000000 0.0000 0.0000 0.00000 0 0.000000 0.0000 0.0000 0.0000 0 0.000000 0.0000 0.0000 0.0000 0 0.000000 0.0000 0.0000 0.0000 0.000000 1047.157418 75018.148200 388421.430605 1600726.543975 0.000000 0.000000 0.033332 0.000000 0.382066 0.000000 0.494556 0.000000 0.509529 0.000000 0 0 0 5921 3172 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5921 0 0 0 0 0 0 0 0 0 0 3172 0 0 0 0.0 3351.17 5010.33
8 100009 913635.389577 121910.485232 -9999.000000 0.000000 0.000000 0.000000 7853.950217 0.000000 31415.800869 0.000000 196348.755442 0.000000 785395.021798 0.000000 3141580.087194 0.000000 0 5594.504963 43218.160325 161834.684399 457872.940419 0 0 0.178079 0.000000 0.220109 0.000000 0.206055 0.000000 0.145746 0.000000 0 0.00000 0.0000 0.0000 0.00000 0 0.000000 0.0000 0.0000 0.00000 0 0.000000 0.0000 0.0000 0.0000 0 0.000000 0.0000 0.0000 0.0000 0 0.000000 0.0000 0.0000 0.0000 0.000000 0.000000 6523.958023 165829.213717 1188020.850995 0.000000 0.000000 0.000000 0.000000 0.033226 0.000000 0.211141 0.000000 0.378160 0.000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0 5696.50 4427.00
9 100010 913635.389577 122238.569221 6.932351 -147.873600 0.861270 0.262515 7853.950216 4911.247372 31415.800869 18082.677132 196348.755442 105610.295941 785395.021784 378958.278703 3141580.087194 1305972.414625 0 9516.669674 58927.634732 163826.495231 481232.788348 0 0 0.302926 0.526287 0.300117 0.557972 0.208591 0.432307 0.153182 0.368486 530 2.83604 31.0923 17.3706 9.11595 1944 2.747340 33.0471 20.8994 8.48463 11361 2.000760 53.6699 27.1614 11.8520 40544 -0.571724 72.4902 32.6554 16.1946 139999 -0.571724 80.4000 34.7767 19.1416 1711.196101 3484.589228 13044.091922 255869.051505 1338189.244976 0.217877 0.348424 0.110918 0.192703 0.066433 0.123512 0.325784 0.675191 0.425961 1.024669 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5696.5 5696.50 3804.14
10 100011 913635.389577 122566.653211 25.593199 -158.656462 143.401367 43.708737 7853.950214 7833.295299 31415.800866 26100.591560 196348.755435 123712.061411 785395.021770 415633.368788 3141580.087165 1382821.741367 0 12915.623512 69362.525664 166341.415814 499342.871997 0 0 0.411119 0.494840 0.353262 0.560677 0.211793 0.400212 0.158946 0.361104 847 5.17336 38.6465 23.7830 9.07310 2810 2.887140 48.0008 25.1452 11.43020 13318 2.000130 58.6473 32.3652 14.5568 44748 1.219650 72.4902 35.8613 16.3781 148264 -0.571724 80.4338 36.4327 19.5750 0.000000 5729.645316 33354.668326 347689.984644 1480585.504400 0.000000 0.000000 0.182381 0.219522 0.169875 0.269615 0.442694 0.836530 0.471287 1.070699 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5696.5 5696.50 4057.00
11 100012 913635.389577 122894.737200 41.408394 -160.210859 287.609447 87.663359 7853.950214 7833.295299 31415.800866 31097.243219 196348.755435 138442.450478 785395.021770 449511.606492 3141580.087165 1442080.725019 0 22701.336280 70677.418960 170197.971004 509770.468600 0 0 0.722609 0.730011 0.359959 0.510518 0.216704 0.378629 0.162266 0.353496 847 9.99947 52.9805 39.4566 9.96918 3347 3.999990 54.8000 34.1710 16.11760 14907 2.836040 72.4902 38.7016 17.5287 48389 2.000020 72.4902 37.9715 15.8371 154622 -0.571724 81.3846 38.0431 19.8535 0.000000 2245.056088 67151.243771 423273.707064 1591062.584934 0.000000 0.000000 0.071463 0.072195 0.342000 0.485048 0.538931 0.941630 0.506453 1.103310 0 0 0 0 5921 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5921 0 0 0 5696.5 6115.75 4486.19
12 100013 913635.389577 123222.821190 53.034622 179.351037 371.361273 113.190916 7853.950214 7833.295299 31415.800866 31374.816076 196348.755435 149029.103334 785395.021770 465933.342537 3141580.087165 1473565.887536 0 20502.653239 65696.131131 175776.890151 514035.067600 0 0 0.652622 0.653475 0.334589 0.440828 0.223807 0.377258 0.163623 0.348838 847 22.67190 58.6473 49.6916 7.82488 3380 4.641180 66.9046 45.3308 16.76630 16050 2.000730 72.4902 44.5061 18.8185 50156 0.745061 72.4902 40.1434 15.1725 158030 -0.571724 81.3846 39.8018 19.8079 0.000000 4842.944719 107110.174083 479774.104777 1725814.534356 0.000000 0.000000 0.154156 0.154358 0.545510 0.718720 0.610870 1.029705 0.549346 1.171182 0 0 0 0 3172 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3172 0 0 292 292.0 6115.75 5596.54
13 100014 913635.389577 123550.905179 65.846687 -177.696901 360.086264 109.754293 7853.950214 7833.295299 31415.800866 31374.816075 196348.755435 154998.827199 785395.021770 467827.476764 3141580.087165 1493784.330328 0 12734.864784 66652.371304 173224.117863 514585.559920 0 0 0.405365 0.405894 0.339459 0.430019 0.220557 0.370274 0.163798 0.344485 844 51.99810 72.4902 65.2612 4.04759 3374 10.170900 72.4902 57.6892 14.00040 16683 3.999510 72.4902 47.9097 17.4790 50326 -0.056434 72.4902 42.0102 14.6979 160214 -0.571724 81.3846 41.4149 19.7177 3944.617269 20031.300381 137884.372519 513698.265307 1783185.553199 0.502246 0.503571 0.637619 0.638452 0.702242 0.889583 0.654064 1.098051 0.567608 1.193737 0 0 0 0 3172 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3172 0 0 292 292.0 6115.75 4777.50
14 100015 913635.389577 123878.989169 71.497841 178.242903 343.741749 104.772485 7853.950217 7833.295299 31415.800871 31374.816076 196348.755450 156508.233075 785395.021798 462348.481404 3141580.087222 1498173.381821 0 9341.121986 58698.232576 163120.219838 501240.054546 0 0 0.297338 0.297727 0.298949 0.375049 0.207692 0.352808 0.159550 0.334567 847 61.99970 72.4002 68.7901 2.05102 3380 10.003700 72.4902 60.7596 11.53860 16844 2.000090 72.4902 47.2621 17.9120 49723 0.000003 72.4902 43.4479 14.5707 160688 -0.571724 85.5132 42.9071 19.5329 8162.291023 41514.745679 169223.516688 541549.758361 1861304.776658 1.039259 1.042000 1.321461 1.323187 0.861852 1.081244 0.689525 1.171302 0.592474 1.242383 0 0 0 0 3172 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3172 0 0 292 4454.0 4230.17 4777.50

Using terminal convert the IPython Notebook to a Markdown file

IPython nbconvert IPythonTest.ipynb --to markdown