changes csv to final output version

Signed-off-by: Dipti <dipti.dhond@candelatech.com>
This commit is contained in:
Dipti
2021-02-16 09:54:00 -08:00
parent aad0595e45
commit 836b24b781
2 changed files with 14 additions and 7 deletions

View File

@@ -637,17 +637,21 @@ class LFCliBase:
return df.to_excel(output_f, index=False)
if output_f == 'df':
return df
supported_formats = ['csv', 'json', 'stata', 'pickle','html']
#for format in supported_formats:
# if output_file_type.lower() == format:
# return exec('df.to_' + x + '("'+file_name'")')
if output_f == 'json':
return df.to_json(output_f)
if output_f == 'stata':
return df.to_stata(output_f)
if output_f == 'pickle':
return df.to_pickle(output_f)
if output_f == 'html':
return df.to_html(output_f)
#takes any format of a file and returns a dataframe of it
def file_to_df(self,file_name):
return pd.read_csv(file_name)
#get difference of all common columns in 2 dataframes. store in
def compare_two_df(self,dataframe_one=None,dataframe_two=None):
pass
#get the columns to be compared

View File

@@ -1331,7 +1331,10 @@ class L3CXProfile(LFCliBase):
#df to final report file output if necessary
if output_format.lower() != 'csv':
dataframe_output = pd.read_csv(report_file)
self.df_to_file(dataframe=dataframe_output, output_f=output_format)
final_file = self.df_to_file(dataframe=dataframe_output, output_f=output_format)
#save final file output
#print(report_file)
def refresh_cx(self):
for cx_name in self.created_cx.keys():