Skip to content

Commit e1ac59c

Browse files
committed
cleanup.
1 parent a29cd6c commit e1ac59c

5 files changed

+65
-19
lines changed

0011_variable_surprises.ipynb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,6 @@
122122
],
123123
"prompt_number": 38
124124
},
125-
{
126-
"cell_type": "markdown",
127-
"source": [
128-
"Exercises:",
129-
"",
130-
"1. Print the following but D.R.Y. (Don't Repeat Yourself):",
131-
"London bridge is falling down, falling down, falling down."
132-
]
133-
},
134125
{
135126
"cell_type": "markdown",
136127
"source": [
@@ -188,8 +179,7 @@
188179
"",
189180
"Revisit the list methods and document some Supplies! in a new cell below. Be prepared to share them with the rest of the class.",
190181
"",
191-
"<iframe width=900 height=400 src=\"http://docs.python.org/tutorial/datastructures.html\"></iframe>",
192-
""
182+
"<iframe width=900 height=400 src=\"http://docs.python.org/tutorial/datastructures.html\"></iframe>"
193183
]
194184
}
195185
]

0030_conditionals.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
"if True: ",
2121
" print \"True is, by definition, true\"",
2222
"if False:",
23-
" print \"If this gets printed, there is something horribly wrong\"",
23+
" print \"If this gets printed, there is something horribly wrong.\"",
2424
"if 1:",
25-
" print \"True/False. 1/0. Good/Evil... well not so much that last one.\"",
25+
" print \"True/False. 1/0. Good/Evil... well, not so much that last one.\"",
2626
"if 0:",
27-
" print \"If this gets printed, there is something horribly wrong\"",
27+
" print \"If this gets printed, there is something horribly wrong.\"",
2828
"a = \"Foo\"",
2929
"if a == \"Foo\":",
3030
" print \"this *evaluates* to True.\"",
@@ -53,7 +53,7 @@
5353
"input": [
5454
"# If, else",
5555
"if False:",
56-
" print \"If this gets printed, there is something horribly wrong\"",
56+
" print \"If this gets printed, there is something horribly wrong.\"",
5757
"else:",
5858
" print \"The alternative\" "
5959
],

0050_reading_from_files.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
{
1616
"cell_type": "code",
17-
"collapsed": false,
17+
"collapsed": true,
1818
"input": [
1919
"of = open(\"./sample_data/lorem_ipsum.txt\") # of is a file-handler",
2020
"my_string = of.read() # read method on the file handler",
@@ -49,7 +49,7 @@
4949
},
5050
{
5151
"cell_type": "code",
52-
"collapsed": false,
52+
"collapsed": true,
5353
"input": [
5454
"of = open(\"./sample_data/hello_world.txt\",\"w\") # note the second argument to open",
5555
"for i in [\"Hello\",\"World\",\"!\"]:",
@@ -63,7 +63,7 @@
6363
},
6464
{
6565
"cell_type": "code",
66-
"collapsed": false,
66+
"collapsed": true,
6767
"input": [
6868
"of = open(\"./sample_data/hello_world.txt\",\"w\") # note the second argument to open",
6969
"for i in [\"Hello\",\"World\",\"!\"]:",

0075_working_with_dates.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"cell_type": "code",
1111
"collapsed": false,
1212
"input": [
13-
"from datetime import date",
13+
"from datetime import date # sneak peak of importing classes from modules!",
1414
"d = date(2012,5,19)",
1515
"print d.year",
1616
"print d.month",

exercise_stocks_correlation_matrix.ipynb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,62 @@
66
"worksheets": [
77
{
88
"cells": [
9+
{
10+
"cell_type": "markdown",
11+
"source": [
12+
"Your goal is to create a correlation matrix like the one below",
13+
"",
14+
"<img src=\"./images/s_and_p500_correlation_matrix.png\" />"
15+
]
16+
},
17+
{
18+
"cell_type": "markdown",
19+
"source": [
20+
"Read in the example data provided in ./sample_data/sp500hst.txt",
21+
" ",
22+
" date,ticker,open,high,low,close,volume",
23+
" 20090821,A,25.6,25.61,25.22,25.55,34758",
24+
" 20090824,A,25.64,25.74,25.33,25.5,22247",
25+
" 20090825,A,25.5,25.7,25.225,25.34,30891",
26+
" 20090826,A,25.32,25.6425,25.145,25.48,33334"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"collapsed": false,
32+
"input": [
33+
"# You need to know this.",
34+
"",
35+
"from scipy.stats.stats import pearsonr",
36+
"",
37+
"a = range(100)",
38+
"b = a[:]",
39+
"b.reverse()",
40+
"print a",
41+
"print b",
42+
"",
43+
"aap,aas = pearsonr(a,a)",
44+
"print aap",
45+
"abp,abs = pearsonr(a,b)",
46+
"print abp",
47+
"",
48+
"for "
49+
],
50+
"language": "python",
51+
"outputs": [
52+
{
53+
"output_type": "stream",
54+
"stream": "stdout",
55+
"text": [
56+
"[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]",
57+
"[99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]",
58+
"1.0",
59+
"-1.0"
60+
]
61+
}
62+
],
63+
"prompt_number": 7
64+
},
965
{
1066
"cell_type": "code",
1167
"collapsed": true,

0 commit comments

Comments
 (0)