Skip to content

Commit de2b8af

Browse files
committed
Remarques de Guillaume sur le TP Pandas
1 parent ff5f896 commit de2b8af

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

content/manipulation/02_pandas_intro/_exo2_solution.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ In question 7, the resulting table looks like this
7575
# Question 7
7676
emissions_totales = (
7777
pd.DataFrame(
78-
df.sum(numeric_only = True),
78+
emissions_copy.sum(numeric_only = True),
7979
columns = ["emissions"]
8080
)
8181
.reset_index(names = "secteur")

content/manipulation/02_pandas_suite.qmd

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ As explained below, we will use a library called `pynsee` to retrieve Insee data
145145
```{python}
146146
#| eval: false
147147
#| echo: true
148-
!pip install xlrd
149-
!pip install pynsee
150-
!pip install great_tables
148+
!pip install xlrd --quiet
149+
!pip install pynsee --quiet
150+
!pip install great_tables --quiet
151151
```
152152

153153
::: {.content-visible when-profile="fr"}
@@ -1102,8 +1102,8 @@ It is surprising to see that Paris, Lyon, and Marseille are present in the commu
11021102
#| echo: true
11031103
emissions.loc[
11041104
emissions["Commune"]
1105-
.str.lower()
1106-
.str.contains('MARSEILLE')
1105+
.str.upper()
1106+
.str.contains('MARSEILLE-')
11071107
]
11081108
```
11091109

@@ -1296,6 +1296,11 @@ codes_postaux.loc[codes_postaux['Code_postal'] == "11420"]
12961296
::: {.content-visible when-profile="fr"}
12971297
En anticipant sur les compétences développées lors des prochains chapitres, nous pouvons représenter le problème sous forme cartographique en prenant l'exemple de l'Aude. Le code pour produire la carte des codes communes est donné tel quel, il n'est pas développé car il fait appel à des concepts et librairies qui seront présentés lors du prochain chapitre:
12981298

1299+
```{python}
1300+
#| echo: true
1301+
!pip install cartiflette --quiet
1302+
```
1303+
12991304
```{python}
13001305
#| echo: true
13011306
#| fig-cap: Géographie des codes postaux et des communes dans l'Aude (11)

content/manipulation/02_pandas_suite/_exo2_solution.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ emissions_wide.reset_index().melt(id_vars = ['INSEE commune','Commune','dep'],
2121
# Question 3
2222
2323
emissions_totales = (
24-
emissions_wide.reset_index()
24+
emissions_wide.reset_index(drop=True)
2525
.melt(
2626
id_vars = ['INSEE commune','Commune','dep'],
2727
var_name = "secteur", value_name = "emissions"
@@ -40,7 +40,7 @@ emissions_totales.plot(kind = "barh")
4040
4141
top_commune_dep = (
4242
emissions_wide
43-
.reset_index()
43+
.reset_index(drop=True)
4444
.melt(
4545
id_vars = ['INSEE commune','Commune','dep'],
4646
var_name = "secteur", value_name = "emissions"

0 commit comments

Comments
 (0)