Skip to content

Commit 90fa1ed

Browse files
committed
Ajout de l'exercice manquant (sélection)
1 parent da38b42 commit 90fa1ed

5 files changed

Lines changed: 230 additions & 0 deletions

File tree

en/02-selection.ipynb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,39 @@
163163
" print(f'The problem: {error}')"
164164
]
165165
},
166+
{
167+
"cell_type": "markdown",
168+
"id": "44cbc36a-59bd-4e78-8f8e-23e4b7073326",
169+
"metadata": {
170+
"lang": "en"
171+
},
172+
"source": [
173+
"### Exercise - Selecting data\n",
174+
"Calculate the average **hindfoot lengths** and\n",
175+
"**weights** of each **species** from `'NL'` to `'PB'`:\n",
176+
"\n",
177+
"1. Start by selecting only the required columns.\n",
178+
"2. At the end, select the rows from `'NL'` to `'PB'`.\n",
179+
"\n",
180+
"(3 min.)"
181+
]
182+
},
183+
{
184+
"cell_type": "code",
185+
"execution_count": null,
186+
"id": "cdb14a63-1037-4bc7-b7e8-48d273d2b2ac",
187+
"metadata": {
188+
"lang": "en",
189+
"tags": [
190+
"exer"
191+
]
192+
},
193+
"outputs": [],
194+
"source": [
195+
"columns = ['species_id', 'hindfoot_length', 'weight']\n",
196+
"surveys_df###.groupby('species_id').mean()###"
197+
]
198+
},
166199
{
167200
"cell_type": "markdown",
168201
"id": "f1babaa7-f6a5-4445-b15c-fdb063e00682",

fr/02-selection.ipynb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,39 @@
163163
" print(f'Le problème : {erreur}')"
164164
]
165165
},
166+
{
167+
"cell_type": "markdown",
168+
"id": "73db3a2a-4d6f-4342-b408-9c4a4f116759",
169+
"metadata": {
170+
"lang": "fr"
171+
},
172+
"source": [
173+
"### Exercice - Une sélection de données\n",
174+
"Calculez la moyenne des **longueurs d'arrière-pieds** et\n",
175+
"des **poids** de chaque **espèce** de `'NL'` à `'PB'` :\n",
176+
"\n",
177+
"1. Commencez par sélectionner uniquement les colonnes requises.\n",
178+
"2. À la fin, sélectionnez les lignes de `'NL'` à `'PB'`.\n",
179+
"\n",
180+
"(3 min.)"
181+
]
182+
},
183+
{
184+
"cell_type": "code",
185+
"execution_count": null,
186+
"id": "d7a08eaf-4ab2-4b57-b8e2-aca33f42b8b3",
187+
"metadata": {
188+
"lang": "fr",
189+
"tags": [
190+
"exer"
191+
]
192+
},
193+
"outputs": [],
194+
"source": [
195+
"colonnes = ['species_id', 'hindfoot_length', 'weight']\n",
196+
"surveys_df###.groupby('species_id').mean()###"
197+
]
198+
},
166199
{
167200
"cell_type": "markdown",
168201
"id": "8f2ce1e8-85cd-4df4-b129-ae9326e305dd",

solution-en/02-selection.ipynb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,39 @@
163163
" print(f'The problem: {error}')"
164164
]
165165
},
166+
{
167+
"cell_type": "markdown",
168+
"id": "44cbc36a-59bd-4e78-8f8e-23e4b7073326",
169+
"metadata": {
170+
"lang": "en"
171+
},
172+
"source": [
173+
"### Exercise - Selecting data\n",
174+
"Calculate the average **hindfoot lengths** and\n",
175+
"**weights** of each **species** from `'NL'` to `'PB'`:\n",
176+
"\n",
177+
"1. Start by selecting only the required columns.\n",
178+
"2. At the end, select the rows from `'NL'` to `'PB'`.\n",
179+
"\n",
180+
"(3 min.)"
181+
]
182+
},
183+
{
184+
"cell_type": "code",
185+
"execution_count": null,
186+
"id": "ecc078ee-438b-4966-8f23-243a297c4f16",
187+
"metadata": {
188+
"lang": "en",
189+
"tags": [
190+
"soln"
191+
]
192+
},
193+
"outputs": [],
194+
"source": [
195+
"columns = ['species_id', 'hindfoot_length', 'weight']\n",
196+
"surveys_df[columns].groupby('species_id').mean().loc['NL':'PB', :]"
197+
]
198+
},
166199
{
167200
"cell_type": "markdown",
168201
"id": "f1babaa7-f6a5-4445-b15c-fdb063e00682",

solution-fr/02-selection.ipynb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,39 @@
163163
" print(f'Le problème : {erreur}')"
164164
]
165165
},
166+
{
167+
"cell_type": "markdown",
168+
"id": "73db3a2a-4d6f-4342-b408-9c4a4f116759",
169+
"metadata": {
170+
"lang": "fr"
171+
},
172+
"source": [
173+
"### Exercice - Une sélection de données\n",
174+
"Calculez la moyenne des **longueurs d'arrière-pieds** et\n",
175+
"des **poids** de chaque **espèce** de `'NL'` à `'PB'` :\n",
176+
"\n",
177+
"1. Commencez par sélectionner uniquement les colonnes requises.\n",
178+
"2. À la fin, sélectionnez les lignes de `'NL'` à `'PB'`.\n",
179+
"\n",
180+
"(3 min.)"
181+
]
182+
},
183+
{
184+
"cell_type": "code",
185+
"execution_count": null,
186+
"id": "5afff414-4369-4d3d-b7ee-8aa2d0a62664",
187+
"metadata": {
188+
"lang": "fr",
189+
"tags": [
190+
"soln"
191+
]
192+
},
193+
"outputs": [],
194+
"source": [
195+
"colonnes = ['species_id', 'hindfoot_length', 'weight']\n",
196+
"surveys_df[colonnes].groupby('species_id').mean().loc['NL':'PB', :]"
197+
]
198+
},
166199
{
167200
"cell_type": "markdown",
168201
"id": "8f2ce1e8-85cd-4df4-b129-ae9326e305dd",

src/02-selection.ipynb

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,104 @@
402402
" print(f'The problem: {error}')"
403403
]
404404
},
405+
{
406+
"cell_type": "markdown",
407+
"id": "73db3a2a-4d6f-4342-b408-9c4a4f116759",
408+
"metadata": {
409+
"lang": "fr"
410+
},
411+
"source": [
412+
"### Exercice - Une sélection de données\n",
413+
"Calculez la moyenne des **longueurs d'arrière-pieds** et\n",
414+
"des **poids** de chaque **espèce** de `'NL'` à `'PB'` :\n",
415+
"\n",
416+
"1. Commencez par sélectionner uniquement les colonnes requises.\n",
417+
"2. À la fin, sélectionnez les lignes de `'NL'` à `'PB'`.\n",
418+
"\n",
419+
"(3 min.)"
420+
]
421+
},
422+
{
423+
"cell_type": "markdown",
424+
"id": "44cbc36a-59bd-4e78-8f8e-23e4b7073326",
425+
"metadata": {
426+
"lang": "en"
427+
},
428+
"source": [
429+
"### Exercise - Selecting data\n",
430+
"Calculate the average **hindfoot lengths** and\n",
431+
"**weights** of each **species** from `'NL'` to `'PB'`:\n",
432+
"\n",
433+
"1. Start by selecting only the required columns.\n",
434+
"2. At the end, select the rows from `'NL'` to `'PB'`.\n",
435+
"\n",
436+
"(3 min.)"
437+
]
438+
},
439+
{
440+
"cell_type": "code",
441+
"execution_count": null,
442+
"id": "5afff414-4369-4d3d-b7ee-8aa2d0a62664",
443+
"metadata": {
444+
"lang": "fr",
445+
"tags": [
446+
"soln"
447+
]
448+
},
449+
"outputs": [],
450+
"source": [
451+
"colonnes = ['species_id', 'hindfoot_length', 'weight']\n",
452+
"surveys_df[colonnes].groupby('species_id').mean().loc['NL':'PB', :]"
453+
]
454+
},
455+
{
456+
"cell_type": "code",
457+
"execution_count": null,
458+
"id": "d7a08eaf-4ab2-4b57-b8e2-aca33f42b8b3",
459+
"metadata": {
460+
"lang": "fr",
461+
"tags": [
462+
"exer"
463+
]
464+
},
465+
"outputs": [],
466+
"source": [
467+
"colonnes = ['species_id', 'hindfoot_length', 'weight']\n",
468+
"surveys_df###.groupby('species_id').mean()###"
469+
]
470+
},
471+
{
472+
"cell_type": "code",
473+
"execution_count": null,
474+
"id": "ecc078ee-438b-4966-8f23-243a297c4f16",
475+
"metadata": {
476+
"lang": "en",
477+
"tags": [
478+
"soln"
479+
]
480+
},
481+
"outputs": [],
482+
"source": [
483+
"columns = ['species_id', 'hindfoot_length', 'weight']\n",
484+
"surveys_df[columns].groupby('species_id').mean().loc['NL':'PB', :]"
485+
]
486+
},
487+
{
488+
"cell_type": "code",
489+
"execution_count": null,
490+
"id": "cdb14a63-1037-4bc7-b7e8-48d273d2b2ac",
491+
"metadata": {
492+
"lang": "en",
493+
"tags": [
494+
"exer"
495+
]
496+
},
497+
"outputs": [],
498+
"source": [
499+
"columns = ['species_id', 'hindfoot_length', 'weight']\n",
500+
"surveys_df###.groupby('species_id').mean()###"
501+
]
502+
},
405503
{
406504
"cell_type": "markdown",
407505
"id": "8f2ce1e8-85cd-4df4-b129-ae9326e305dd",

0 commit comments

Comments
 (0)