-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfinalTouchDataFrame.py
More file actions
33 lines (27 loc) · 1000 Bytes
/
Copy pathfinalTouchDataFrame.py
File metadata and controls
33 lines (27 loc) · 1000 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
#!/usr/bin/env python
# (C) Copyright 2019-2020, PwC
#
# @brief final dataframe building
import numpy as np
import pandas as pd
from framework.commonConstants import *
from config import rootDir, dataframeWithVector, dataframeFinal
from os.path import join
dfPath = join(rootDir, dataframeWithVector + PKL)
def updateDF(index, content, dataframe):
colList = [FULL_CONTENT_VECTOR, CONTENT_SUMMARY_1_VECTOR, CONTENT_SUMMARY_2_VECTOR,
CONTENT_SUMMARY_3_VECTOR, NAME_VECTOR, DESCRIPTION_VECTOR]
for col in colList:
try:
if content[col] == 0:
dataframe.loc[index][col] = np.array(dOfVector*[0])
except:
pass
return dataframe
if __name__ == '__main__':
df = pd.read_pickle(dfPath)
for idx, content in df.iterrows():
df = updateDF(index=idx,
content=content,
dataframe=df)
df.to_pickle(join(rootDir, dataframeFinal + PKL))