-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSV_handler.py
More file actions
44 lines (26 loc) · 888 Bytes
/
CSV_handler.py
File metadata and controls
44 lines (26 loc) · 888 Bytes
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
'''
* CSV_handler.py
*
* Created on: 08.02.2019
* Author: Philippe Lehmann
*
* General description:
* https://realpython.com/python-csv/
'''
import csv
import numpy as np
from itertools import islice
class CSV_handler:
def __init__(self, _writer, _reader):
self.writer = _writer
self.reader = _reader
def setVectorLength(self, _N):
self.writer.setVectorLength( _N )
self.reader.setVectorLength( _N )
def appendVectorsToFile(self, _vectors, _fileName):
self.writer.writeVectorsToFile( _vectors, 'a', _fileName )
def writeVectorsToNewFile(self, _vectors, _fileName):
self.writer.writeVectorsToFile( _vectors, 'w', _fileName )
def getVectorBlockFromFile(self, _fileName, _blockSize):
return self.reader.getVectorBlockFromFile(_fileName, _blockSize)
''' END '''