UE8: notebook séance 1
2+3
5
a=7
a
7
a+3
10
a=12
a
12
3+4
7
3.0 + 12.5
15.5
3.0 ** 2
9.0
3.5 ** 12.32
5045663.764331118
"Toto" + "est" + "content"
'Totoestcontent'
"Toto " + "est " + "content"
'Toto est content'
True or (True and False)
True
'A' < 'a'
True
'B' < 'a'
True
'é' < 'f'
False
a = 3
carre = 3**2
print("Le carre de 3 est "+str(carre))
carrecarre = carre ** 2
carrecarre
Le carre de 3 est 9
81
import math
a = 1
b = -12
c = 35
delta = b ** 2 - 4 * a * c
# il faudrait tester delta ...
x1 = (-b + math.sqrt(delta)) / (2 * a)
x2 = (-b - math.sqrt(delta)) / (2 * a)
poly = str(a)+" x^2 + "+str(b)+" x + "+str(c)
print("Les solutions de "+poly+" sont "+str(x1)+" et "+str(x2))
Les solutions de 1 x^2 + -12 x + 35 sont 7.0 et 5.0
prix_bombon = 0.10
prix_croissant = 1.0
prix_pain = 1.2
total = prix_bombon * 8
total = total + prix_croissant * 5
total = total + prix_pain * 2
print("Je dois "+str(total)+" euros")
Je dois 8.2 euros
import pandas
df = pandas.read_excel("Donnees_M2_RD.xlsx")
df
Subject | Name_A | Name_B | Dist_A | Dist_B | Mode | Space | Side | Response | RT | |
---|---|---|---|---|---|---|---|---|---|---|
0 | P_ADI_331 | 0 | 2 | 2 | 4 | Dic | E | D | 2 | 18865 |
1 | P_ADI_331 | 1 | 4 | 4 | 1 | Dic | E | D | 2 | 13157 |
2 | P_ADI_331 | 4 | 3 | 3 | 2 | Dic | E | D | 1 | 11628 |
3 | P_ADI_331 | 2 | 4 | 4 | 1 | Dic | E | D | 1 | 10068 |
4 | P_ADI_331 | 1 | 2 | 2 | 4 | Dic | E | D | 1 | 11801 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
9589 | P_VAR_330 | 0 | 1 | 3 | 5 | Dio | I | D | 1 | 7626 |
9590 | P_VAR_330 | 3 | 2 | 5 | 1 | Dio | I | D | 2 | 6349 |
9591 | P_VAR_330 | 2 | 0 | 4 | 2 | Dio | I | D | 2 | 9031 |
9592 | P_VAR_330 | 0 | 2 | 2 | 1 | Dio | I | D | 2 | 16323 |
9593 | P_VAR_330 | 0 | 3 | 5 | 1 | Dio | I | D | 2 | 10139 |
9594 rows × 10 columns
df["Subject"]
0 P_ADI_331
1 P_ADI_331
2 P_ADI_331
3 P_ADI_331
4 P_ADI_331
...
9589 P_VAR_330
9590 P_VAR_330
9591 P_VAR_330
9592 P_VAR_330
9593 P_VAR_330
Name: Subject, Length: 9594, dtype: object
df[["Subject","Name_A"]]
Subject | Name_A | |
---|---|---|
0 | P_ADI_331 | 0 |
1 | P_ADI_331 | 1 |
2 | P_ADI_331 | 4 |
3 | P_ADI_331 | 2 |
4 | P_ADI_331 | 1 |
... | ... | ... |
9589 | P_VAR_330 | 0 |
9590 | P_VAR_330 | 3 |
9591 | P_VAR_330 | 2 |
9592 | P_VAR_330 | 0 |
9593 | P_VAR_330 | 0 |
9594 rows × 2 columns
subj = df["Subject"]
subj
0 P_ADI_331
1 P_ADI_331
2 P_ADI_331
3 P_ADI_331
4 P_ADI_331
...
9589 P_VAR_330
9590 P_VAR_330
9591 P_VAR_330
9592 P_VAR_330
9593 P_VAR_330
Name: Subject, Length: 9594, dtype: object
subj.drop_duplicates()
0 P_ADI_331
400 P_ALM_345
800 P_AMY_346
1200 P_BAM_347
1600 P_BEH_340
2000 P_BLC_325
2399 P_BLR_321
2798 P_BOA_321
3197 P_BOC_342
3597 P_CAR_327
3995 P_CAV_333
4395 P_CON_336
4795 P_GAM_338
5195 P_GHM_334
5595 P_GRC_341
5995 P_GRF_322
6394 P_LAC_354
6794 P_LEG_335
7194 P_MOE_339
7594 P_ROS_336
7994 P_SOA_337
8394 P_TAI_343
8794 P_VAL_329
9194 P_VAR_330
Name: Subject, dtype: object