Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider 28b64c84 rédigé par E214194U's avatar E214194U
Parcourir les fichiers

rfin

parent e58b5caf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -40,7 +40,7 @@ def ex1_3_4():
axes2.plot(data['2019_F']-data['2019_H'],data['age'],label="Différence",color="green")
axes2.set_title("2019")
fig.suptitle("Pyramide des ages en France")
axes1.legend(handles=[line1, line2,line3],loc='lower center', bbox_to_anchor=(0.5, -0.2, 0., 0.5),ncol=3)
#axes1.legend(handles=[line1, line2,line3],loc='lower center', bbox_to_anchor=(0.5, -0.2, 0., 0.5),ncol=3)
fig.tight_layout()
plt.show()
......
x,y
1.66682253523682,1.6933312906529299
1.9798324641605407,2.0364079286370838
1.723740278334009,1.8699489420268274
1.716738638335051,1.7934590422794545
1.7572019608715153,1.724191260530918
1.7128236623145292,1.611283961632483
1.4356423932965918,1.4597001484133523
1.9214554554292935,1.9298095708727983
1.5533981568451292,1.5177357384146326
1.994902623470273,1.9693550553997061
1.671861041552685,1.694422292428485
1.328628077559553,1.3175072625461275
1.2018198903492894,1.2996850674067788
1.949546739426648,1.8979854430541028
1.5346784924919425,1.624305619261097
x,y
2.959857425632835,0.09614976443288098
2.820299457583266,0.2609419938242007
2.499176001543351,0.45921796025963224
2.8131452004056756,0.19898503166467565
2.260174444899172,0.6161078394970023
2.1664360785922985,0.8585215169693703
3.0056357124336546,0.06297495601881718
2.2505109146262714,0.740488416846824
2.7340684650959943,0.3150932238423231
2.1971113883120243,0.8121167756233967
2.4256037612386496,0.7024383232806811
2.102684939364214,0.8736390068172122
2.8004625406232293,0.2861213110002471
2.8935494071246004,0.12557308307063414
2.5383508380548276,0.5290381234225771
x,y
1.0007574322589754,0.9545973217592059
0.9891307774541653,1.004727276499499
0.9848428424365473,1.0295502709968907
1.0015260962969876,0.9886039422641724
1.0043820746964234,0.9752271300993305
0.995818063402338,0.9962012053114743
1.000215112846741,0.963062961006867
0.964422229925692,0.9963631869439187
0.9983846751050857,1.0118547061938419
1.006766433672599,1.0023081088285481
0.9764262164756188,0.9652473760494117
1.0393023939876607,1.0104980296221109
0.9898504066230317,0.9985772653900656
0.9760801628675354,1.0035933902003416
1.0116897404763951,0.986179585502337
x,y
1.5,1.5
x,y
0.9881614489045576,0.9940631010678133
2.0021247117025527,1.4149645619953006
3.0136779142792602,1.7359947909712345
3.9949051598674843,1.9987258841240547
4.995769234426853,2.2351217493521136
6.002740554205586,2.4500490922031717
7.024769079076701,2.6504280935495497
8.017234670554286,2.83147217372064
8.9746817211973,2.9957773150214786
9.97685728131858,3.158616355513689
10.990025913580038,3.315120799243979
12.006552897582656,3.4650473153454424
12.989632149669925,3.604113226532974
13.969641790863797,3.7375983988202632
14.99851036023298,3.8727910297656107
16.01512261146078,4.001889879976806
17.019554768880393,4.125476308122542
18.010719265503766,4.24390377665467
18.968928886360022,4.355333384066026
19.978854640174426,4.469771206692175
x,y
-4.983756072204823,24.837824587238444
-4.47757365620345,20.048665846727133
-3.9493220810944925,15.597144900220533
-3.4451425630401715,11.869007279671003
-2.856846771324043,8.161573474824609
-2.3783789594700395,5.656686474849788
-1.8065779335871914,3.2637238301241664
-1.319886261671772,1.742099743749885
-0.8285736268283929,0.6865342550755569
-0.2376606793478902,0.05648259850810068
0.2699742376853415,0.07288608901378127
0.7855050542706168,0.6170181902846846
1.30193037017,1.6950226887709934
1.8821452579262605,3.5424707719343096
2.3557910398678543,5.549751423521666
2.907951703891357,8.456183112164647
3.401831633342589,11.572458461610308
3.9252597353376157,15.40766398986273
4.486216662183872,20.126139940056202
5.012310083714155,25.1232523753026
Parent Income Rank,College Attendance Rates
0,"0,246"
1,"0,261"
2,"0,271"
3,"0,282"
4,"0,288"
5,"0,299"
6,"0,306"
7,"0,314"
8,"0,319"
9,"0,323"
10,"0,329"
11,"0,337"
12,"0,343"
13,"0,349"
14,"0,356"
15,"0,360"
16,"0,369"
17,"0,377"
18,"0,380"
19,"0,389"
20,"0,395"
21,"0,403"
22,"0,410"
23,"0,415"
24,"0,418"
25,"0,427"
26,"0,432"
27,"0,440"
28,"0,443"
29,"0,451"
30,"0,459"
31,"0,468"
32,"0,472"
33,"0,479"
34,"0,487"
35,"0,493"
36,"0,501"
37,"0,506"
38,"0,509"
39,"0,519"
40,"0,523"
41,"0,530"
42,"0,533"
43,"0,541"
44,"0,544"
45,"0,552"
46,"0,562"
47,"0,564"
48,"0,569"
49,"0,577"
50,"0,585"
51,"0,593"
52,"0,594"
53,"0,606"
54,"0,609"
55,"0,612"
56,"0,620"
57,"0,629"
58,"0,635"
59,"0,640"
60,"0,646"
61,"0,654"
62,"0,660"
63,"0,666"
64,"0,672"
65,"0,684"
66,"0,689"
67,"0,696"
68,"0,703"
69,"0,713"
70,"0,716"
71,"0,726"
72,"0,732"
73,"0,739"
74,"0,747"
75,"0,754"
76,"0,764"
77,"0,771"
78,"0,779"
79,"0,786"
80,"0,792"
81,"0,803"
82,"0,811"
83,"0,819"
84,"0,823"
85,"0,833"
86,"0,842"
87,"0,850"
88,"0,861"
89,"0,866"
90,"0,875"
91,"0,885"
92,"0,893"
93,"0,900"
94,"0,908"
95,"0,914"
96,"0,920"
97,"0,927"
98,"0,934"
99,"0,938"
import csv as csv
from turtle import color
from typing import List
from unicodedata import decimal
import matplotlib.pyplot as plt
from psutil import LINUX
def csvopen(A):
with open(A, newline='') as csvfile:
data = csv.reader(csvfile, delimiter=',')
Liste=[]
for row in data:
Liste.append(list(row))
for i in range(1,len(Liste)):
Liste[i] = [float(s) for s in Liste[i]]
Lx=[]
Ly=[]
for i in range(1,len(Liste)):
Lx.append(Liste[i][0])
Ly.append(Liste[i][1])
return Lx,Ly
def point_moyen(X,Y):
moyX=sum(X)/len(X)
moyY=sum(Y)/len(Y)
return moyX,moyY
def coeff_corr(X,Y):
add=0
for i in range(len(X)):
add+=X[i]*Y[i]
add=add/len(X)
mX,mY=point_moyen(X,Y)
return add-mX*mY
def coeffs_droite_reg(X,Y):
mX,mY=point_moyen(X,Y)
a=coeff_corr(X,Y)/coeff_corr(X,X)
b=mY-(coeff_corr(X,Y)/coeff_corr(X,X)*mX)
return a,b
def etude(X,Y):
ig, ax = plt.subplots()
mX,mY=point_moyen(X,Y)
ax.scatter(X, Y,color='blue')
ax.scatter(mX, mY,color='Orange')
a,b=coeffs_droite_reg(X,Y)
correc=[]
for i in X:
correc.append(a*i+b)
ax.plot(X, correc,color='Orange')
ax.set_title(f"{coeff_corr(X,Y)}")
plt.show()
def main():
Lx,Ly=csvopen("ExBsetA.csv")
L2x,L2y=csvopen("ExBsetB.csv")
Lx+=L2x
Ly+=L2y
etude(Lx,Ly)
if __name__ == '__main__':
main()
\ No newline at end of file
# x y
1.000000 5.350009
1.045226 5.330573
1.090452 5.846848
1.135678 4.565231
1.180905 4.629330
1.226131 5.989690
1.271357 5.846016
1.316583 5.025292
1.361809 5.096260
1.407035 5.814693
1.452261 5.318524
1.497487 6.351204
1.542714 6.739752
1.587940 5.983371
1.633166 6.704139
1.678392 6.827779
1.723618 6.776082
1.768844 6.826517
1.814070 6.278642
1.859296 7.571817
1.904523 6.444861
1.949749 7.583053
1.994975 7.351510
2.040201 6.520457
2.085427 7.698788
2.130653 6.824046
2.175879 7.764227
2.221106 7.837668
2.266332 7.567468
2.311558 8.400373
2.356784 7.561973
2.402010 9.095670
2.447236 8.881552
2.492462 9.174303
2.537688 8.821539
2.582915 8.589116
2.628141 9.343108
2.673367 8.473726
2.718593 9.303052
2.763819 9.436755
2.809045 8.800928
2.854271 10.150936
2.899497 8.806074
2.944724 9.474539
2.989950 9.485253
3.035176 10.150876
3.080402 9.991898
3.125628 9.888448
3.170854 9.716515
3.216080 10.981903
3.261307 9.604266
3.306533 10.889372
3.351759 10.458565
3.396985 10.092394
3.442211 10.431283
3.487437 10.451493
3.532663 11.093604
3.577889 10.404577
3.623116 11.040341
3.668342 11.413664
3.713568 11.769462
3.758794 11.648653
3.804020 11.797463
3.849246 11.152528
3.894472 12.047036
3.939698 12.080987
3.984925 12.648235
4.030151 12.200534
4.075377 11.598411
4.120603 12.383052
4.165829 11.824136
4.211055 12.563547
4.256281 13.422814
4.301508 12.871729
4.346734 12.352129
4.391960 13.390047
4.437186 14.121084
4.482412 13.810747
4.527638 13.280983
4.572864 14.007683
4.618090 14.839108
4.663317 14.665825
4.708543 13.713035
4.753769 14.959268
4.798995 14.305504
4.844221 14.257616
4.889447 13.899227
4.934673 15.351871
4.979899 15.722959
5.025126 15.399200
5.070352 15.401633
5.115578 14.475479
5.160804 15.386240
5.206030 15.240553
5.251256 15.660105
5.296482 15.371186
5.341709 16.035321
5.386935 15.353563
5.432161 16.211999
5.477387 16.514905
5.522613 15.607548
5.567839 16.314286
5.613065 16.099081
5.658291 16.119861
5.703518 16.157991
5.748744 17.125820
5.793970 17.748102
5.839196 17.343995
5.884422 18.428096
5.929648 17.097640
5.974874 17.204464
6.020101 18.157160
6.065327 18.443616
6.110553 18.441188
6.155779 18.415586
6.201005 18.936797
6.246231 18.744447
6.291457 19.312904
6.336683 18.147518
6.381910 19.786496
6.427136 18.276405
6.472362 19.360537
6.517588 18.941676
6.562814 18.847312
6.608040 19.670921
6.653266 18.967241
6.698492 19.784692
6.743719 20.355868
6.788945 19.520793
6.834171 20.118747
6.879397 21.303050
6.924623 20.744193
6.969849 21.592399
7.015075 21.700377
7.060302 21.648098
7.105528 20.824499
7.150754 21.681058
7.195980 22.421424
7.241206 22.119458
7.286432 21.442126
7.331658 21.505945
7.376884 22.332306
7.422111 22.289120
7.467337 22.742114
7.512563 21.848816
7.557789 22.332000
7.603015 22.903375
7.648241 22.833165
7.693467 23.068874
7.738693 24.113747
7.783920 24.138965
7.829146 22.989233
7.874372 24.090274
7.919598 23.956019
7.964824 24.021956
8.010050 24.364882
8.055276 25.200686
8.100503 24.471920
8.145729 25.209996
8.190955 23.901772
8.236181 24.868866
8.281407 24.249084
8.326633 24.834749
8.371859 25.109737
8.417085 24.830084
8.462312 26.448559
8.507538 26.089365
8.552764 25.224476
8.597990 25.357383
8.643216 26.201686
8.688442 26.635145
8.733668 26.034418
8.778894 26.440065
8.824121 26.620932
8.869347 27.168616
8.914573 27.387710
8.959799 26.606733
9.005025 26.906442
9.050251 28.101335
9.095477 28.461973
9.140704 27.451136
9.185930 27.921858
9.231156 28.330908
9.276382 27.685475
9.321608 29.232629
9.366834 29.529234
9.412060 28.297275
9.457286 28.803801
9.502513 29.744560
9.547739 28.656249
9.592965 29.211632
9.638191 29.045113
9.683417 29.685106
9.728643 30.384333
9.773869 29.762931
9.819095 30.551164
9.864322 30.785315
9.909548 30.181993
9.954774 30.174788
10.000000 30.584167
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter