-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreader.py
More file actions
35 lines (30 loc) · 1.11 KB
/
reader.py
File metadata and controls
35 lines (30 loc) · 1.11 KB
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
import csv
import numpy
class Reader:
def __init__(self):
with open('config/data.csv', 'r', encoding="utf-8") as file:
reader = csv.reader(file)
init_data = [row for row in reader]
message_count = int(init_data[0][0])
channel_id = init_data[0][1]
messages = numpy.zeros((message_count,2), dtype=object)
data_array = numpy.zeros((message_count,2,20), dtype=object)
index = int(1)
for x in range(message_count):
messages[x,0] = init_data[index][0]
ahead = int(init_data[index][1])
messages[x,1] = ahead
index = index + 1
next_index = index + ahead
y = int(0)
while index < next_index:
data_array[x,0,y] = init_data[index][0]
data_array[x,1,y] = init_data[index][1]
y = y + 1
index = index + 1
self.channel = channel_id
self.mcount = message_count
self.messages = messages
self.data = data_array
def read():
return Reader()