File tree Expand file tree Collapse file tree 2 files changed +131
-28
lines changed Expand file tree Collapse file tree 2 files changed +131
-28
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"metadata" : {
3
3
"name" : " " ,
4
- "signature" : " sha256:60a4c5c217936c0f2f09da9eb33c21aabef60b11111b98ab15f01d64ab80006e "
4
+ "signature" : " sha256:bfca8ede59adad1aeea1439f49f58e1afa4ea7d9edfe8ac3e662dff650e172f4 "
5
5
},
6
6
"nbformat" : 3 ,
7
7
"nbformat_minor" : 0 ,
122
122
"cell_type" : " code" ,
123
123
"collapsed" : false ,
124
124
"input" : [
125
- " ind = (df['key1'] == 'a') & (df['data'] > 0.5 )"
125
+ " ind = (df['key1'] == 'a') & (df['data'] > 0.2 )"
126
126
],
127
127
"language" : " python" ,
128
128
"metadata" : {},
129
129
"outputs" : [],
130
- "prompt_number" : 4
130
+ "prompt_number" : 10
131
131
},
132
132
{
133
133
"cell_type" : " code" ,
141
141
{
142
142
"metadata" : {},
143
143
"output_type" : " pyout" ,
144
- "prompt_number" : 5 ,
144
+ "prompt_number" : 11 ,
145
145
"text" : [
146
- " 0 False \n " ,
146
+ " 0 True \n " ,
147
147
" 1 False\n " ,
148
148
" 2 False\n " ,
149
149
" 3 False\n " ,
152
152
]
153
153
}
154
154
],
155
- "prompt_number" : 5
155
+ "prompt_number" : 11
156
156
},
157
157
{
158
158
"cell_type" : " code" ,
190
190
"language" : " python" ,
191
191
"metadata" : {},
192
192
"outputs" : [],
193
- "prompt_number" : 8
193
+ "prompt_number" : 12
194
194
},
195
195
{
196
196
"cell_type" : " markdown" ,
225
225
" <th>0</th>\n " ,
226
226
" <td> 0.215410</td>\n " ,
227
227
" <td> a</td>\n " ,
228
- " <td> one </td>\n " ,
228
+ " <td> 0.2154102 </td>\n " ,
229
229
" </tr>\n " ,
230
230
" <tr>\n " ,
231
231
" <th>1</th>\n " ,
257
257
],
258
258
"metadata" : {},
259
259
"output_type" : " pyout" ,
260
- "prompt_number" : 9 ,
260
+ "prompt_number" : 13 ,
261
261
"text" : [
262
262
" data key1 key2\n " ,
263
- " 0 0.215410 a one \n " ,
263
+ " 0 0.215410 a 0.2154102 \n " ,
264
264
" 1 0.025453 a two\n " ,
265
265
" 2 0.360868 b one\n " ,
266
266
" 3 0.853243 b two\n " ,
267
267
" 4 0.794009 a 0.7940085"
268
268
]
269
269
}
270
270
],
271
- "prompt_number" : 9
271
+ "prompt_number" : 13
272
272
},
273
273
{
274
274
"cell_type" : " code" ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"metadata" : {
3
3
"name" : " " ,
4
- "signature" : " sha256:4df052cc8c56936d4bac355ac1bda0ff5199c6e9ed5f39a23f6107ac442b924e "
4
+ "signature" : " sha256:5ebed62298b4a7912e2f7e33c377c13bb6d31b8e00c48d9f79c908fe3a6a2552 "
5
5
},
6
6
"nbformat" : 3 ,
7
7
"nbformat_minor" : 0 ,
19
19
"outputs" : [],
20
20
"prompt_number" : 1
21
21
},
22
- {
23
- "cell_type" : " code" ,
24
- "collapsed" : false ,
25
- "input" : [
26
- " offset = 2"
27
- ],
28
- "language" : " python" ,
29
- "metadata" : {},
30
- "outputs" : [],
31
- "prompt_number" : 2
32
- },
33
22
{
34
23
"cell_type" : " code" ,
35
24
"collapsed" : false ,
106
95
"cell_type" : " code" ,
107
96
"collapsed" : false ,
108
97
"input" : [
109
- " permute1(a, -1)"
98
+ " permute1(a, 6)"
99
+ ],
100
+ "language" : " python" ,
101
+ "metadata" : {},
102
+ "outputs" : [
103
+ {
104
+ "metadata" : {},
105
+ "output_type" : " pyout" ,
106
+ "prompt_number" : 25 ,
107
+ "text" : [
108
+ " [1, 2, 3, 4, 0]"
109
+ ]
110
+ }
111
+ ],
112
+ "prompt_number" : 25
113
+ },
114
+ {
115
+ "cell_type" : " code" ,
116
+ "collapsed" : false ,
117
+ "input" : [
118
+ " def permute2(inList, offset):\n " ,
119
+ " offset %= len(inList)\n " ,
120
+ " return inList[offset:] + inList[:offset]"
121
+ ],
122
+ "language" : " python" ,
123
+ "metadata" : {},
124
+ "outputs" : [],
125
+ "prompt_number" : 30
126
+ },
127
+ {
128
+ "cell_type" : " code" ,
129
+ "collapsed" : false ,
130
+ "input" : [
131
+ " permute2(a, 1)"
132
+ ],
133
+ "language" : " python" ,
134
+ "metadata" : {},
135
+ "outputs" : [
136
+ {
137
+ "metadata" : {},
138
+ "output_type" : " pyout" ,
139
+ "prompt_number" : 34 ,
140
+ "text" : [
141
+ " [1, 2, 3, 4, 0]"
142
+ ]
143
+ }
144
+ ],
145
+ "prompt_number" : 34
146
+ },
147
+ {
148
+ "cell_type" : " code" ,
149
+ "collapsed" : false ,
150
+ "input" : [
151
+ " permute2(a, 2)"
110
152
],
111
153
"language" : " python" ,
112
154
"metadata" : {},
113
155
"outputs" : [
114
156
{
115
157
"metadata" : {},
116
158
"output_type" : " pyout" ,
117
- "prompt_number" : 16 ,
159
+ "prompt_number" : 33 ,
160
+ "text" : [
161
+ " [2, 3, 4, 0, 1]"
162
+ ]
163
+ }
164
+ ],
165
+ "prompt_number" : 33
166
+ },
167
+ {
168
+ "cell_type" : " code" ,
169
+ "collapsed" : false ,
170
+ "input" : [
171
+ " permute2(a, -1)"
172
+ ],
173
+ "language" : " python" ,
174
+ "metadata" : {},
175
+ "outputs" : [
176
+ {
177
+ "metadata" : {},
178
+ "output_type" : " pyout" ,
179
+ "prompt_number" : 38 ,
118
180
"text" : [
119
181
" [4, 0, 1, 2, 3]"
120
182
]
121
183
}
122
184
],
123
- "prompt_number" : 16
185
+ "prompt_number" : 38
186
+ },
187
+ {
188
+ "cell_type" : " code" ,
189
+ "collapsed" : false ,
190
+ "input" : [
191
+ " a = range(1000)"
192
+ ],
193
+ "language" : " python" ,
194
+ "metadata" : {},
195
+ "outputs" : [],
196
+ "prompt_number" : 42
197
+ },
198
+ {
199
+ "cell_type" : " code" ,
200
+ "collapsed" : false ,
201
+ "input" : [
202
+ " %timeit permute1(a,500)"
203
+ ],
204
+ "language" : " python" ,
205
+ "metadata" : {},
206
+ "outputs" : [
207
+ {
208
+ "output_type" : " stream" ,
209
+ "stream" : " stdout" ,
210
+ "text" : [
211
+ " 1000 loops, best of 3: 207 \u00b5 s per loop\n "
212
+ ]
213
+ }
214
+ ],
215
+ "prompt_number" : 43
124
216
},
125
217
{
126
218
"cell_type" : " code" ,
127
219
"collapsed" : false ,
128
- "input" : [],
220
+ "input" : [
221
+ " %timeit permute2(a,500)"
222
+ ],
129
223
"language" : " python" ,
130
224
"metadata" : {},
131
- "outputs" : []
225
+ "outputs" : [
226
+ {
227
+ "output_type" : " stream" ,
228
+ "stream" : " stdout" ,
229
+ "text" : [
230
+ " 100000 loops, best of 3: 7.63 \u00b5 s per loop\n "
231
+ ]
232
+ }
233
+ ],
234
+ "prompt_number" : 45
132
235
}
133
236
],
134
237
"metadata" : {}
You can’t perform that action at this time.
0 commit comments