Skip to content

Commit 4ce2010

Browse files
committed
Modify the notebooks
1 parent 030d860 commit 4ce2010

File tree

2 files changed

+38
-134
lines changed

2 files changed

+38
-134
lines changed

pandas-example.ipynb

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
{
3030
"cell_type": "code",
31-
"execution_count": 121,
31+
"execution_count": 26,
3232
"metadata": {
3333
"collapsed": true
3434
},
@@ -48,7 +48,7 @@
4848
},
4949
{
5050
"cell_type": "code",
51-
"execution_count": 122,
51+
"execution_count": 27,
5252
"metadata": {
5353
"collapsed": false
5454
},
@@ -68,7 +68,7 @@
6868
},
6969
{
7070
"cell_type": "code",
71-
"execution_count": 123,
71+
"execution_count": 28,
7272
"metadata": {
7373
"collapsed": false
7474
},
@@ -77,26 +77,26 @@
7777
"data": {
7878
"text/plain": [
7979
"0 2.0\n",
80-
"1 5.0\n",
81-
"2 9.0\n",
82-
"3 5.0\n",
80+
"1 3.0\n",
81+
"2 3.0\n",
82+
"3 -5.0\n",
8383
"dtype: float64"
8484
]
8585
},
86-
"execution_count": 123,
86+
"execution_count": 28,
8787
"metadata": {},
8888
"output_type": "execute_result"
8989
}
9090
],
9191
"source": [
92-
"A.add(B, fill_value=0)"
92+
"A.subtract(B, fill_value=0)"
9393
]
9494
},
9595
{
9696
"cell_type": "markdown",
9797
"metadata": {},
9898
"source": [
99-
"Notice that indices are aligned correctly irrespective of their order in the two objects, and indices in the result are sorted.\n",
99+
"Observe that the indices align accurately regardless of their sequence in the two objects, and the result's indices are organized in ascending order.\n",
100100
"As was the case with ``Series``, we can use the associated object's arithmetic method and pass any desired ``fill_value`` to be used in place of missing entries.\n",
101101
"Here we'll fill with the mean of all values in ``A`` (computed by first stacking the rows of ``A``):"
102102
]
@@ -150,40 +150,40 @@
150150
" <tbody>\n",
151151
" <tr>\n",
152152
" <th>0</th>\n",
153-
" <td>19.00</td>\n",
154-
" <td>20.00</td>\n",
155-
" <td>16.75</td>\n",
153+
" <td>10.0</td>\n",
154+
" <td>26.0</td>\n",
155+
" <td>55.0</td>\n",
156156
" </tr>\n",
157157
" <tr>\n",
158158
" <th>1</th>\n",
159-
" <td>8.00</td>\n",
160-
" <td>3.00</td>\n",
161-
" <td>12.75</td>\n",
159+
" <td>16.0</td>\n",
160+
" <td>19.0</td>\n",
161+
" <td>55.0</td>\n",
162162
" </tr>\n",
163163
" <tr>\n",
164164
" <th>2</th>\n",
165-
" <td>16.75</td>\n",
166-
" <td>10.75</td>\n",
167-
" <td>12.75</td>\n",
165+
" <td>53.0</td>\n",
166+
" <td>56.0</td>\n",
167+
" <td>52.0</td>\n",
168168
" </tr>\n",
169169
" </tbody>\n",
170170
"</table>\n",
171171
"</div>"
172172
],
173173
"text/plain": [
174-
" A B C\n",
175-
"0 19.00 20.00 16.75\n",
176-
"1 8.00 3.00 12.75\n",
177-
"2 16.75 10.75 12.75"
174+
" A B C\n",
175+
"0 10.0 26.0 55.0\n",
176+
"1 16.0 19.0 55.0\n",
177+
"2 53.0 56.0 52.0"
178178
]
179179
},
180-
"execution_count": 127,
180+
"execution_count": 30,
181181
"metadata": {},
182182
"output_type": "execute_result"
183183
}
184184
],
185185
"source": [
186-
"fill = A.stack().mean()\n",
186+
"fill = A.stack().sum()\n",
187187
"A.add(B, fill_value=fill)"
188188
]
189189
},
@@ -200,20 +200,20 @@
200200
},
201201
{
202202
"cell_type": "code",
203-
"execution_count": 128,
203+
"execution_count": 31,
204204
"metadata": {
205205
"collapsed": false
206206
},
207207
"outputs": [
208208
{
209209
"data": {
210210
"text/plain": [
211-
"array([[1, 5, 5, 9],\n",
212-
" [3, 5, 1, 9],\n",
213-
" [1, 9, 3, 7]])"
211+
"array([[7, 7, 2, 5],\n",
212+
" [4, 1, 7, 5],\n",
213+
" [1, 4, 0, 9]])"
214214
]
215215
},
216-
"execution_count": 128,
216+
"execution_count": 31,
217217
"metadata": {},
218218
"output_type": "execute_result"
219219
}
@@ -225,7 +225,7 @@
225225
},
226226
{
227227
"cell_type": "code",
228-
"execution_count": 129,
228+
"execution_count": 32,
229229
"metadata": {
230230
"collapsed": false
231231
},
@@ -234,11 +234,11 @@
234234
"data": {
235235
"text/plain": [
236236
"array([[ 0, 0, 0, 0],\n",
237-
" [ 2, 0, -4, 0],\n",
238-
" [ 0, 4, -2, -2]])"
237+
" [-3, -6, 5, 0],\n",
238+
" [-6, -3, -2, 4]])"
239239
]
240240
},
241-
"execution_count": 129,
241+
"execution_count": 32,
242242
"metadata": {},
243243
"output_type": "execute_result"
244244
}

0 commit comments

Comments
 (0)