Skip to content

Commit 914fbec

Browse files
committed
added solutions to 04
1 parent 80eacf0 commit 914fbec

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

_episodes/04-more-dataframes.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ surveys_df[0:3]
254254
{: .callout}
255255
256256
257-
<!-- Add in R exercise here -->
258257
259258
> ## Slice syntax in R
260259
>
@@ -278,7 +277,7 @@ surveys_df[0:3]
278277
>
279278
> _Remember: R begins indexing lists at 1._
280279
>
281-
<!-- > > ## Solution
280+
> > ## Solution
282281
> >
283282
> > With the same list:
284283
> > `['A','B','C','D','E','F','G','H','I','J']`,
@@ -314,8 +313,8 @@ surveys_df[0:3]
314313
> > return a 0-length vector of the same type.
315314
> > This is ignored when you use the syntax
316315
> > `x[0:5]`, and the elements in `1` through
317-
> > `5` are printed.
318-
> {: .solution} -->
316+
> > `5` are returned.
317+
> {: .solution}
319318
{: .challenge}
320319
321320
@@ -325,7 +324,7 @@ surveys_df[0:3]
325324
> Combine selecting a subset with column headings and slice syntax for rows. Get
326325
> every 5th row for rows 20-60, from the columns `plot_id`, `species_id`, and `sex`.
327326
>
328-
<!-- > > ## Solution
327+
> > ## Solution
329328
> >
330329
> > ~~~
331330
> > surveys_df[['plot_id', 'species_id','sex']][20:61:5]
@@ -345,7 +344,7 @@ surveys_df[0:3]
345344
> > 60 23 DM M
346345
> > ~~~
347346
> > {: .output}
348-
> {: .solution} -->
347+
> {: .solution}
349348
{: .challenge}
350349
351350
## Changing Values in a DataFrame
@@ -610,7 +609,7 @@ surveys_df.loc[1:4, ['record_id','month']]
610609
>
611610
> 2. Use `.iloc[]` to view the same thing.
612611
>
613-
<!-- > > ## Solution
612+
> > ## Solution
614613
> >
615614
> > ~~~
616615
> > # 1
@@ -620,7 +619,7 @@ surveys_df.loc[1:4, ['record_id','month']]
620619
> > surveys_df.iloc[1:6:2, [5,6]]
621620
> > ~~~
622621
> > {: .python}
623-
> {: .solution} -->
622+
> {: .solution}
624623
{: .challenge}
625624
626625
@@ -674,7 +673,7 @@ surveys_df[(surveys_df.sex == 'M') & (surveys_df.year <= 1985)]
674673
> the year 1999 and that contain weight values less than or equal to 8. How
675674
> many rows did you end up with?
676675
>
677-
<!-- > > ## Solution
676+
> > ## Solution
678677
> >
679678
> > ~~~
680679
> > surveys_df[(surveys_df.weight <= 8.0) & (surveys_df.year == 1999)]
@@ -696,7 +695,7 @@ surveys_df[(surveys_df.sex == 'M') & (surveys_df.year <= 1985)]
696695
> > 29905 4.0
697696
> > ~~~
698697
> > {: .output}
699-
> {: .solution} -->
698+
> {: .solution}
700699
{: .challenge}
701700
702701
## Iterating Over a DataFrame

0 commit comments

Comments
 (0)