I have a function that writes the content of df into csv file.
def writeToCSV(outDf, defFile, toFile, retainFlag=True, delim='\t', quotechar='"'):
headers = []
fid = open(defFile, 'r')
for line in fid:
headers.append(line.replace('\r','').split('\n')[0].split('\t')[0])
df = pd.DataFrame([], columns=headers)
for header in outDf.columns.values:
if header in headers:
df[header] = outDf[header]
df.to_csv(toFile, sep=delim, quotechar=quotechar, index=False, encoding='utf-8')
Run Code Online (Sandbox Code Playgroud)
How can i parallelize this process? Currently i am using following code
def writeToSchemaParallel(outDf, defFile, toFile, retainFlag=True, delim='\t', quotechar='"'):
logInfo('Start writingtoSchema in parallel...', 'track')
headers = []
fid …Run Code Online (Sandbox Code Playgroud)