Skip to content

Commit 6c1049e

Browse files
committed
05-merging-data.md: fix some code blocks
1 parent d7e091c commit 6c1049e

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

_episodes/05-merging-data.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,6 @@ merged_inner
252252
~~~
253253
{: .language-python}
254254

255-
**OUTPUT:**
256-
257255
~~~
258256
record_id month day year plot_id species_id sex hindfoot_length \
259257
0 1 7 16 1977 2 NL M 32
@@ -326,11 +324,10 @@ inner join, but using the `how='left'` argument:
326324

327325
~~~
328326
merged_left = pd.merge(left=survey_sub,right=species_sub, how='left', left_on='species_id', right_on='species_id')
329-
330327
merged_left
331-
332-
**OUTPUT:**
333-
328+
~~~
329+
{: .language-python}
330+
~~~
334331
record_id month day year plot_id species_id sex hindfoot_length \
335332
0 1 7 16 1977 2 NL M 32
336333
1 2 7 16 1977 3 NL M 33
@@ -355,7 +352,7 @@ merged_left
355352
8 NaN Dipodomys merriami Rodent
356353
9 NaN NaN NaN NaN
357354
~~~
358-
{: .language-python}
355+
{: .output}
359356

360357
The result DataFrame from a left join (`merged_left`) looks very much like the
361358
result DataFrame from an inner join (`merged_inner`) in terms of the columns it
@@ -367,7 +364,9 @@ missing (they contain NaN values):
367364

368365
~~~
369366
merged_left[ pd.isnull(merged_left.genus) ]
370-
**OUTPUT:**
367+
~~~
368+
{: .language-python}
369+
~~~
371370
record_id month day year plot_id species_id sex hindfoot_length \
372371
5 6 7 16 1977 1 PF M 14
373372
9 10 7 16 1977 6 PF F 20
@@ -376,7 +375,7 @@ merged_left[ pd.isnull(merged_left.genus) ]
376375
5 NaN NaN NaN NaN
377376
9 NaN NaN NaN NaN
378377
~~~
379-
{: .language-python}
378+
{: .output}
380379

381380
These rows are the ones where the value of `species_id` from `survey_sub` (in this
382381
case, `PF`) does not occur in `species_sub`.

0 commit comments

Comments
 (0)