Commit 85e79b6c authored by Bertrand  NÉRON's avatar Bertrand NÉRON
Browse files

🔥 remove old notebooks

parent e9fd9849
This diff is collapsed.
%% Cell type:markdown id:3731abb9-a087-4a54-bdf2-d8046145ad30 tags:
# <center>**TP**</center>
<img src="./images/pandas_logo.svg">
<div style="text-align:center">
Bertrand Néron
<br />
<a src=" https://research.pasteur.fr/en/team/bioinformatics-and-biostatistics-hub/">Bioinformatics and Biostatistiqucs HUB</a>
<br />
© Institut Pasteur, 2021
</div>
%% Cell type:code id:07a7668b-c3a8-4e1b-94cd-1c6e5cbca62e tags:
``` python
```
%% Cell type:code id:57795cc2-9ce8-4000-970f-731ffe80aac5 tags:
``` python
import pandas as pd
```
%% Cell type:markdown id:6a65859a-1bd8-4073-bf48-6798cc00ae99 tags:
read the 'data/city_temperature.csv'
force the City datatype to string by passing
```
dtype={'City': str}
```
As argument to the function to read the file.<br />
Don't worry to the warning, it is due to State wich contains Nan for non US contry, but we do not use these data
%% Cell type:code id:f7ca7b5c-488b-4b3e-b96f-0818b79ee5b3 tags:
``` python
```
%% Cell type:code id:1be5c2d5-f3cc-477e-ae55-0638a203ec4e tags:
``` python
```
%% Cell type:markdown id:f271729c-5c7a-451b-99df-54a884043a88 tags:
We will work only on Europe Region. so creat data named europe with only these data.
explore it a lit bit
* how many data?
* which columns?
* index?
%% Cell type:code id:6b69163d-f147-4d48-bb0e-7129c57b9057 tags:
``` python
```
%% Cell type:code id:eeb1ae09-f0ae-4f6e-862c-581aac9b09f8 tags:
``` python
```
%% Cell type:code id:1d1065bd-092f-4042-af0e-dae8b78d79d5 tags:
``` python
```
%% Cell type:markdown id:3d0ca497-c0ad-4582-b54b-d26557cf30eb tags:
wich country are in europe?
%% Cell type:code id:fb49d50b-cc16-409e-8d7f-8500f077a596 tags:
``` python
```
%% Cell type:markdown id:1211fd0a-4879-4169-984f-e604341c82c3 tags:
remove columns 'Region' and 'State' from the data
%% Cell type:code id:f6e17279-a0e0-4082-93c8-52c80ccfaa4c tags:
``` python
```
%% Cell type:markdown id:1be6e117-e807-4910-8faf-4b09f08ee810 tags:
from europe data create a new dataset containing countries: 'France', 'Spain', 'Italy'
%% Cell type:code id:5e4e5959-f5f4-498a-aa9f-e3e4d8505086 tags:
``` python
```
%% Cell type:markdown id:7f49bcf4-884d-4d55-beb5-7f9b238f6333 tags:
group the data on 'City' and 'Year' compute the mean of each group and keep only the 'AvgTemperature' column.
%% Cell type:code id:774ce218-9d3a-4306-a6c8-67c55e3b4f83 tags:
``` python
```
%% Cell type:markdown id:3a5e3e0e-b49c-4c7a-974a-12dd41e846a3 tags:
do the same but compute the standard deviation
%% Cell type:code id:f76fc4d8-3de7-479f-a797-8bffea0459d7 tags:
``` python
```
%% Cell type:markdown id:3d0ab3ad-6ba3-4fdd-b6ce-1393965d080c tags:
* reset the index fo the mean data and std data
* rename the column AvgTemperature to Tmp on the mean data
* rename the column AvgTemperature to std on the std data
%% Cell type:code id:9ad90621-eba1-4ae8-8d61-853c7884dc01 tags:
``` python
```
%% Cell type:markdown id:d300f6b7-6a98-42e0-b6e1-d7eea277443a tags:
merge the two tables data_mean and data_std
%% Cell type:code id:68fc7eb5-e9a9-4757-a470-553bd9dd81ee tags:
``` python
```
%% Cell type:markdown id:5c0a9ad6-7ba5-4061-8a1f-b852b934cc8f tags:
save the data in a file
%% Cell type:code id:a0be61a1-0d08-4ccf-b1dc-761ab7ea0fc3 tags:
``` python
```
%% Cell type:markdown id:05668aae-b68b-48de-a70f-4fe269125611 tags:
# Teasing
a quick data plotting. we will improve it in matplotlib course
%% Cell type:code id:6b588f07-3103-403e-beab-0cdc23bb7d8d tags:
``` python
for city, df in clean_data.groupby('City'):
df.plot('Year', 'Tmp', label=city)
```
%% Cell type:code id:fdc3ad9c-9984-4390-85ba-de36860db524 tags:
``` python
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment