-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomplexExample.py
66 lines (48 loc) · 2.34 KB
/
complexExample.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
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
from WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)
if __name__=="__main__":
# Example
# PreRequisitesGODS.VerifyRequirements()
handler = DataHandler(r'e.g/complex/bd.xlsx')
# handler = DataHandler(r'e.g/complex/bd.csv', ";")
# handler = DataHandler(r'e.g/complex/bd.json')
handler.getArchive().setDelimiter('==')
handler.setDtype({"CPF":str, "DATA":str})
handler.readFile()
print(handler.getArchive().getData())
handler.getArchive().setAdditionalParameters("NAME", "bold", True)
handler.getArchive().setAdditionalParameters("DATE", "bold", True)
handler.getArchive().setAdditionalParameters("COUNTRY", 'italic', True)
To.languageTo('pt_BR')
request={0:{'filesToRead':r'e.g/complex/doc2.docx',
'fileRename':'FirstExampleWithValue - {}',
'formatKeys':['NAME']
},
1:{'filesToRead':r'e.g/complex/doc.docx',
'fileRename':'{} - {} - SecondExampleWithAlotData {}',
'formatKeys':['DATE','NAME', 'COUNTRY']
},
}
for i in range(len(request)):
handler.getArchive().transformData("HOUR", To.Hour().to_hh_mm)
handler.getArchive().transformData("DATE", lambda x: To.Date().to_personalizedFormat(x, '%d de %B de %Y'))
# handler.getArchive().transformData("DATE", To.Date().to_dd_mm_yyyy)
build = Builder(handler.getArchive(), request[i]['filesToRead'])
build.generate()
handler.getArchive().transformData("DATE", To.Date().to_dd_mm_yy_periodSep)
keysFormatting = request[i]['formatKeys']
keysFormatting.insert(0, 'DATE')
build.saveAs(textAtFile="DOCS/{}/"+request[i]['fileRename'],
keyColumn=keysFormatting, ZipFile=True,
saveLocally=True)
#----
## Print Out Data
print(handler.getArchive().getData())
print('\n')
for each, values in handler.getArchive().getData().items():
print(each, values)
print(build.getTimeToGenerate())
#----
### Creates a .xlsx with the analysed data from .docx
doc_files = ["e.g/complex/doc.docx", "e.g/complex/doc2.docx"]
transmitter = Transmitter(doc_files, '==')
transmitter.export("exampleExport.xlsx")