-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPr2.py
40 lines (34 loc) · 993 Bytes
/
Pr2.py
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
import numpy as np
import matplotlib.pyplot as plt
f = open("Files/project_data.csv" , "r" )
text=f.read()
f.close()
# print(text)
# داده را به صورت خط به خط جدا کردیم #
lines=text.split("\n")
# print(lines)
# تشکیل یک لیست کلی که عصو های آن
# لیست های متشکل از ستون هایی
# استرینگ میباشند
table=[]
for line in lines:
if line:
columns=line.split(",")
table.append(columns)
#حذف خط اول که عنوان ستون ها هستند
table.pop(0)
# print(table)
# خط به خط ستون های مورد نظر
# را درون لیست دیگری میریزیم
values_columns=[]
for column in table:
values_columns.append([int(column[1]),int(float(column[5]))])
values_columns.reverse()
# print(values_columns)
values_array=np.array(values_columns)
values_close=values_array[:,1]
days=values_array[:,0]
days=days
print(days)
plt.plot(values_close)
plt.show()