mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 19:28:00 +00:00
correction of str concatenation, defaulting to csv file creation
This commit is contained in:
@@ -618,7 +618,7 @@ class LFCliBase:
|
|||||||
|
|
||||||
#================ Pandas Dataframe Functions ======================================
|
#================ Pandas Dataframe Functions ======================================
|
||||||
|
|
||||||
#takes any format of a file and returns a dataframe of it
|
#takes any dataframe and returns the specified outputfile format of it
|
||||||
def df_to_file(dataframe, outputfile_name_path):
|
def df_to_file(dataframe, outputfile_name_path):
|
||||||
df = dataframe
|
df = dataframe
|
||||||
if output_file_type == 'hdf':
|
if output_file_type == 'hdf':
|
||||||
@@ -632,10 +632,10 @@ class LFCliBase:
|
|||||||
return df.to_excel(output_file_type, index=False)
|
return df.to_excel(output_file_type, index=False)
|
||||||
if output_file_type == 'df':
|
if output_file_type == 'df':
|
||||||
return df
|
return df
|
||||||
#supported_formats = ['csv', 'json', 'stata', 'pickle','html']
|
supported_formats = ['csv', 'json', 'stata', 'pickle','html']
|
||||||
#for format in supported_formats:
|
for format in supported_formats:
|
||||||
# if output_file_type.lower() == format:
|
if output_file_type.lower() == format:
|
||||||
# return exec('df.to_' + x + '("'+file_name'")')
|
return exec('df.to_' + x + '("'+file_name'")')
|
||||||
|
|
||||||
#takes any format of a file and returns a dataframe of it
|
#takes any format of a file and returns a dataframe of it
|
||||||
def file_to_df(file_type, file_name):
|
def file_to_df(file_type, file_name):
|
||||||
|
|||||||
@@ -1235,8 +1235,8 @@ class L3CXProfile(LFCliBase):
|
|||||||
raise ValueError("Cannot find columns requested to be searched. Exiting script, please retry.")
|
raise ValueError("Cannot find columns requested to be searched. Exiting script, please retry.")
|
||||||
if monitor:
|
if monitor:
|
||||||
if debug:
|
if debug:
|
||||||
print("Json response from LANforge... " + response)
|
print("Json response from LANforge... " + str(response))
|
||||||
#timestamp
|
|
||||||
t = datetime.datetime.now()
|
t = datetime.datetime.now()
|
||||||
|
|
||||||
timestamp= t.strftime("%m/%d/%Y %I:%M:%S")
|
timestamp= t.strftime("%m/%d/%Y %I:%M:%S")
|
||||||
@@ -1268,10 +1268,12 @@ class L3CXProfile(LFCliBase):
|
|||||||
csvfile.close()
|
csvfile.close()
|
||||||
|
|
||||||
#here, do column manipulations
|
#here, do column manipulations
|
||||||
|
|
||||||
dataframe_output = self.file_to_df()
|
|
||||||
#here, do csv to df
|
|
||||||
#here, do df to final report file output
|
#here, do df to final report file output
|
||||||
|
if output_format.lower() != 'csv':
|
||||||
|
dataframe_output = self.file_to_df()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def refresh_cx(self):
|
def refresh_cx(self):
|
||||||
|
|||||||
@@ -273,7 +273,9 @@ python3 ./test_ipv4_variable_time.py
|
|||||||
|
|
||||||
|
|
||||||
if args.output_format in ['csv','json','html','hdf','stata','pickle','pdf','png','df','parquet','xlsx']:
|
if args.output_format in ['csv','json','html','hdf','stata','pickle','pdf','png','df','parquet','xlsx']:
|
||||||
report_f= str(path) + '/data.' + args.output_format
|
#always save to csv first
|
||||||
|
report_f= str(path) + '/data.csv'
|
||||||
|
#report_f= str(path) + '/data.' + args.output_format
|
||||||
print(report_f)
|
print(report_f)
|
||||||
output=args.output_format
|
output=args.output_format
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user