Bonjour je me permet de vous contacter car je rencontre une erreur pour lire un fichier excel avec un code python censé fonctionner.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from __future__ import division
import xlrd
import matplotlib.pyplot as plt
from pylab import*
 
document = xlrd.open_workbook("aero-5.xlsx")
 
print("Nombre de feuilles: "+str(document.nsheets))
print("Noms des feuilles: "+str(document.sheet_names()))
 
feuille_1 = document.sheet_by_index(0)
 
 
print("Format de la feuille 1:")
print("Nom: "+str(feuille_1.name))
print("Nombre de lignes: "+str(feuille_1.nrows))
print("Nombre de colonnes: "+str(feuille_1.ncols))
 
cols = feuille_1.ncols
rows = feuille_1.nrows
 
X = []
Y= []
X1 =[]
Y1 = []
 
for r in(range(14,26)):
  X += [feuille_1.cell_value(rowx=r, colx= 8)]
  Y += [feuille_1.cell_value(rowx=r, colx= 3)]
#print (X)
 
#plt.plot(X, Y)
#plt.show()
 
for r in range(13,1,-1):
    X += [feuille_1.cell_value(rowx=r, colx= 8)]
    Y += [feuille_1.cell_value(rowx=r, colx= 3)]
 
X = X + [-0.01]
Y = Y + [2.324504562]
 
#print(X)
print(Y)
for r in(range(14,26)):
  X1 += [feuille_1.cell_value(rowx=r, colx= 7)]
  Y1 += [feuille_1.cell_value(rowx=r, colx= 8)]
 
#print (X)
 
#plt.plot(X, Y)
#plt.show()
 
for r in range(13,1,-1):
  X1 += [feuille_1.cell_value(rowx=r, colx= 7)]
  Y1 += [feuille_1.cell_value(rowx=r, colx= 8)]
X1 = [0] + X1 +[0]
Y1 = [0] +Y1 +[0]
 
X1.insert(13,1)
Y1.insert(13,0)
figure = plt.figure(1)
ax = figure.add_subplot(111)
ax.plot(X,Y, color ='blue', label = 'cp')
 
X, Y, dx, dy = X[21], Y[21], X[21]-X[20], Y[21]-Y[20]
plt.quiver(X, Y, dx, dy, scale_units='xy', angles='xy', scale=1, width=0.005)
plt.plot(Y1,X1,'r',label = 'x/c en fonction de z/c')
plt.plot([0.077],[1.5],'og',label = 'E')
plt.plot([-0.044],[0.1754],'ok', label = 'I')
 
plt.xlabel('z/c')
plt.ylabel('Cpj')
plt.legend() 
plt.title('Evolution du coefficient de pression en fonction de z/c')
plt.show()

Nom : python.PNG
Affichages : 218
Taille : 19,6 KoNom : python.PNG
Affichages : 218
Taille : 19,6 Koaero-5.xlsx