Skip to content

Commit 3a45a60

Browse files
committed
w7 jb2 ok
1 parent 1532930 commit 3a45a60

File tree

4 files changed

+46
-86
lines changed

4 files changed

+46
-86
lines changed

myst-toc.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,36 @@ project:
6363
- title: semaine 6
6464
children:
6565
- pattern: w6/w6-s*.md
66-
# - title: semaine 7
67-
# children:
68-
# - pattern: w7/w7-s*.md
66+
- title: semaine 7
67+
children:
68+
- file: w7/w7-s01-c1-installation.md
69+
- file: w7/w7-s02-c1-dimension1.md
70+
- file: w7/w7-s02-c2-dtype.md
71+
- file: w7/w7-s03-c1-shape.md
72+
- file: w7/w7-s03-c2-initialisation.md
73+
- file: w7/w7-s05-c1-broadcasting.md
74+
- file: w7/w7-s05-c2-indexing-slicing.md
75+
- file: w7/w7-s05-c3-operations-logiques.md
76+
- file: w7/w7-s05-c4-algebre-lineaire.md
77+
- file: w7/w7-s05-c5-indexation-evoluee.md
78+
- file: w7/w7-s05-c6-divers.md
79+
- file: w7/w7-s05-x1-checkers.md
80+
- file: w7/w7-s05-x2-hundreds.md
81+
- file: w7/w7-s05-x3-stairs.md
82+
- file: w7/w7-s05-x4-dice.md
83+
- file: w7/w7-s05-x5-matdiag.md
84+
- file: w7/w7-s05-x6-xixj.md
85+
- file: w7/w7-s05-x7-npsearch.md
86+
- file: w7/w7-s06-c1-data-science.md
87+
- file: w7/w7-s06-c2-Series.md
88+
- file: w7/w7-s07-c1-DataFrame.md
89+
- file: w7/w7-s09-c1-TimeSeries.md
90+
- file: w7/w7-s10-c1-matplotlib-2d.md
91+
- file: w7/w7-s10-c2-matplotlib-3d.md
92+
- file: w7/w7-s10-c3-notebooks-interactifs.md
93+
- file: w7/w7-s10-c3-zz-plotly-dashboard.md
94+
- file: w7/w7-s10-c4-animations-matplotlib.md
95+
- file: w7/w7-s10-c5-bokeh-et-al.md
96+
- file: w7/w7-s10-c6-fourier-k3d.md
97+
- file: w7/w7-s10-x1-taylor.md
98+
- file: w7/w7-s10-x2-coronavirus.md

w7/w7-s05-x1-checkers.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ jupytext:
88
extension: .md
99
format_name: myst
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
1515
name: python
16+
nbconvert_exporter: python
1617
pygments_lexer: ipython3
1718
nbhosting:
1819
title: 'exercice: checkers'
@@ -88,6 +89,7 @@ Pour le voir comme une image:
8889
---
8990
slideshow:
9091
slide_type: fragment
92+
tags: [raises-exception]
9193
---
9294
# convertir en flottant pour imshow
9395
checkerboard = checkerboard.astype(float)

w7/w7-s05-x3-stairs.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ jupytext:
88
extension: .md
99
format_name: myst
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
1515
name: python
16+
nbconvert_exporter: python
1617
pygments_lexer: ipython3
1718
nbhosting:
1819
title: 'exercice: stairs'
@@ -82,6 +83,8 @@ squares = stairs(100)
8283
Pour le voir comme une image avec un niveau de gris comme code de couleurs (noir = 0, blanc = maximum = 201 dans notre cas) :
8384

8485
```{code-cell} ipython3
86+
:tags: [raises-exception]
87+
8588
# convertir en flottant pour imshow
8689
squares = squares.astype(float)
8790
# afficher avec une colormap 'gray'

w7/w7-s10-x2-coronavirus.md

Lines changed: 6 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ jupytext:
99
extension: .md
1010
format_name: myst
1111
kernelspec:
12-
display_name: Python 3
12+
display_name: Python 3 (ipykernel)
1313
language: python
1414
name: python3
1515
language_info:
1616
name: python
17+
nbconvert_exporter: python
1718
pygments_lexer: ipython3
1819
nbhosting:
1920
title: 'Exercice: coronavirus'
@@ -233,97 +234,21 @@ df1.plot();
233234

234235
## Exercice 2: idem mais à partir d'un autre jeu de données
235236

236-
+++
237-
238237
Je vous signale une autre source de données, dans ce repo git <https://github.com/owid/covid-19-data/tree/master/public/data>; les données cette fois-ci sont au format excel, et publiées à cette adresse
239238

240239
```{code-cell} ipython3
241240
alt_url = 'https://covid.ourworldindata.org/data/owid-covid-data.csv'
242241
```
243242

244-
Dans ces cas-là il faut avoir le réflexe d'utiliser pandas; voici un aperçu (ayez de la patience pour le chargement)
245-
246-
```{code-cell} ipython3
247-
import pandas as pd
243+
```{admonition} mise à jour oct. 2025
244+
:class: danger
248245
249-
df = pd.read_csv(alt_url)
246+
il semble que cette URL est à présent inaccessible
247+
je supprime donc le deuxième exercice de ce notebook
250248
```
251249

252-
```{code-cell} ipython3
253-
df.head(2)
254-
```
255-
256-
### Un sujet possible (#2)
257-
258-
+++
259-
260-
Le sujet à la base est le même bien entendu, essayer de visualiser ces données sous une forme où on y perçoit quelque chose :)
261-
262-
Les données sont bien entendu beaucoup plus riches, *a contrario* cela va demander davantage de mise en forme avant de pouvoir visualiser quoi que ce soit.
263-
264-
Je vous propose ce second point de vue si vous souhaitez vous entraîner avec `pandas`, puisqu'ici on a déjà une dataframe (ce qui ne veut pas dire qu'on ne peut pas traiter le premier exercice en utilisant `pandas`).
265-
266-
+++
267-
268-
### Explorons un peu
269-
270250
+++
271251

272-
Voici quelques éléments sur la stucture de ces données :
273-
274-
```{code-cell} ipython3
275-
# beaucoup plus de détails
276-
df.columns
277-
```
278-
279-
```{code-cell} ipython3
280-
# la colonne iso_code représente le pays :
281-
df.iso_code.unique()[:5]
282-
```
283-
284-
```{code-cell} ipython3
285-
# rien que sur la france, on a ce nombre d'enregistrements
286-
df_france = df[df.iso_code == 'FRA']
287-
len(df_france)
288-
```
289-
290-
```{code-cell} ipython3
291-
# manifestement c'est un par jour
292-
df_france.head(2)
293-
```
294-
295-
```{code-cell} ipython3
296-
df_france.tail(2)
297-
```
298-
299-
Pour afficher, disons les décès par jour en France depuis le début de la pandémie, on pourrait faire :
300-
301-
```{code-cell} ipython3
302-
df_france.plot(x='date', y='new_deaths');
303-
```
304-
305-
```{code-cell} ipython3
306-
# n'hésitez pas à installer des packages
307-
# supplémentaires au besoin
308-
!pip install plotly-express
309-
```
310-
311-
```{code-cell} ipython3
312-
# plusieurs courbes en une
313-
# avec plotly express, pour changer un peu
314-
import plotly.express as px
315-
316-
selection = ['USA', 'FRA']
317-
318-
start = '2020-03-15'
319-
date_start = start
320-
#date_start = pd.to_datetime(start)
321-
sel = df[(df.iso_code.isin(selection)) & (df.date > date_start)]
322-
fig1 = px.line(sel, x="date", y="total_deaths_per_million", color="location")
323-
fig1.update_layout(height= 800, title_text="Décès Covid, cumulés (par million d'habitants)")
324-
fig1.show()
325-
```
326-
327252
## Comment partager ?
328253

329254
+++

0 commit comments

Comments
 (0)