Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > fr.comp.lang.python > #3017
| Newsgroups | fr.comp.lang.python |
|---|---|
| Date | 2018-01-20 06:59 -0800 |
| Message-ID | <2f5f9fc0-2db0-49f2-830c-b86bda4dd63c@googlegroups.com> (permalink) |
| Subject | Tracer une courbe à partir d'un fichier text |
| From | baladjy@gmail.com |
Bonjour à tous,
Je suis débutant sur python. Je souhaiterai savoir comment on fait pour tracer une courbe à partir d'un fichier text
Voici les données dans le fichier text :
X Y
0 47047.969
1 46959.758
2 46855.414
3 46701.742
4 46354.426
5 44898.340
6 36412.832
7 18628.641
8 7671.260
9 5338.369
10 4831.740
voici le code que j'ai écris :
import matplotlib.pyplot as plt
import numpy as np
f = open("Values.txt" , 'r')
t = f.readlines()
t.remove(t[0])
list = []
for i in t:
list.append(i.split())
for i in range(len(list)):
value=list[i]
#print(value)
w =[]
for i in range(len(value)):
w = value[i]
w = float(w)
y = []
y.append(w)
print(y[:,0])
Comment fait on pour créer une liste pour x et une autre liste pour y?
et ensuite le tracer ?
Merci,
cordialement,
Back to fr.comp.lang.python | Previous | Next — Next in thread | Find similar
Tracer une courbe à partir d'un fichier text baladjy@gmail.com - 2018-01-20 06:59 -0800
Re: Tracer une courbe à partir d'un fichier text Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2018-01-20 18:12 +0100
Re: Tracer une courbe à partir d'un fichier text baladjy@gmail.com - 2018-01-20 12:45 -0800
Re: Tracer une courbe à partir d'un fichier text yves <yves@free.invalid> - 2018-01-21 10:35 +0000
Re: Tracer une courbe à partir d'un fichier text yves <yves@free.invalid> - 2018-01-21 16:01 +0000
Re: Tracer une courbe à partir d'un fichier text marc@marc.marc - 2018-01-22 13:41 +0100
csiph-web