diff --git a/py-json/LANforge/lfcli_base.py b/py-json/LANforge/lfcli_base.py index f9fc84b5..aad7121a 100644 --- a/py-json/LANforge/lfcli_base.py +++ b/py-json/LANforge/lfcli_base.py @@ -16,9 +16,7 @@ from LANforge import LFRequest import LANforge.LFRequest import csv import pandas as pd -import tables -import pyarrow as pa -#import xlsxwriter + class LFCliBase: @@ -611,8 +609,10 @@ class LFCliBase: #takes any dataframe and returns the specified file extension of it def df_to_file(self, output_f=None,dataframe=None, save_path=None): if output_f.lower() == 'hdf': + import tables dataframe.to_hdf(save_path.replace('csv','h5',1), 'table', append=True) if output_f.lower() == 'parquet': + import pyarrow as pa dataframe.to_parquet(save_path.replace('csv','parquet',1), engine='pyarrow') if output_f.lower() == 'png': fig = dataframe.plot().get_figure() @@ -635,6 +635,23 @@ class LFCliBase: def compare_two_df(self,dataframe_one=None,dataframe_two=None): + pd.set_option("display.max_rows", None, "display.max_columns", None) + #get all of common columns besides Timestamp, Timestamp milliseconds + common_cols = set(dataframe_one.columns).intersection(set(dataframe_two.columns)) + if common_cols is not None: + cols_to_remove=['Timestamp milliseconds epoch','Timestamp','LANforge GUI Build: 5.4.3'] + #drop unwanted cols from df + dataframe_one = dataframe_one.drop(list(cols_to_remove), axis=1) + dataframe_two = dataframe_two.drop(list(cols_to_remove), axis=1) + #for time elapsed section and endpoint name combo + # + print(dataframe_one) + print(dataframe_two) + + + #take those columns and separate those columns from others in DF. + + pass #return compared_df diff --git a/py-json/realm.py b/py-json/realm.py index 657a1cff..d2aaf8d9 100755 --- a/py-json/realm.py +++ b/py-json/realm.py @@ -1299,7 +1299,6 @@ class L3CXProfile(LFCliBase): for key in port_mgr_values_dict.keys(): renamed_port_cols['port mgr - ' +key]=port_mgr_values_dict[key] merge.update(renamed_port_cols) - print(header_row[3:-3]) for name in header_row[3:-3]: temp_list.append(merge[name]) csvwriter.writerow(temp_list) @@ -1323,6 +1322,7 @@ class L3CXProfile(LFCliBase): #comparison to last report / report inputted if compared_report is not None: compared_df = self.compare_two_df(dataframe_one=self.file_to_df(report_file), dataframe_two=self.file_to_df(compared_report)) + exit(1) #append compared df to created one if output_format.lower() != 'csv': self.df_to_file(dataframe=pd.read_csv(report_file), output_f=output_format, save_path=report_file) diff --git a/py-scripts/test_ipv4_variable_time.py b/py-scripts/test_ipv4_variable_time.py index 7addebba..04324a5b 100755 --- a/py-scripts/test_ipv4_variable_time.py +++ b/py-scripts/test_ipv4_variable_time.py @@ -314,8 +314,10 @@ python3 ./test_ipv4_variable_time.py compared_report_format=args.compared_report.split('.')[-1] #if compared_report_format not in ['csv', 'json', 'dta', 'pkl','html','xlsx','parquet','h5']: if compared_report_format != 'csv': - ValueError("Cannot process this file type. Please select a different file and re-run script.") + print(ValueError("Cannot process this file type. Please select a different file and re-run script.")) exit(1) + else: + compared_rept=args.compared_report station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio)