-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerateoutput.py
executable file
·37 lines (26 loc) · 1.16 KB
/
generateoutput.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
#!/bin/env python3
import pandas as pd
def createoutputtable():
data = [{'contributors': 'Bob Anna', 'name': 'WebServer', 'project_pos':0},
{'contributors': 'Maria Bob', 'name': 'WebChat', 'project_pos':2},
{'contributors': 'Anna', 'name': 'Logging', 'project_pos':1},
]
# project_organization = pd.DataFrame(columns = ['contributors', 'name', 'project_pos'])
project_organization = pd.DataFrame(data)
return project_organization
def generateoutput(fileout, project_organization):
print("About to write organization")
print(project_organization)
print(f"\nWrite output in: {fileout}")
fout = open(fileout, "w")
fout.write(str(len(project_organization.index)) + '\n')
project_organization.project_pos.astype(int)
project_organization = project_organization.sort_values(by=['project_pos'])
project_organization.reset_index()
for i, row in project_organization.iterrows():
fout.write(row['name'] + '\n')
fout.write(row['contributors'] + '\n')
fout.close()
if __name__ == "__main__":
project_organization = createoutputtable()
generateoutput("toto.tmp.txt", project_organization)