From f5b1fae73ed3a1cb70ab9fc523c71239bbef746f Mon Sep 17 00:00:00 2001 From: Dipti Date: Wed, 27 Jan 2021 15:10:57 -0800 Subject: [PATCH] continuation of old csv and new csv file comparison --- py-json/realm.py | 26 ++++++++++++++++++++++++++ py-scripts/test_ipv4_variable_time.py | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/py-json/realm.py b/py-json/realm.py index 905a6c04..e3f8fff9 100755 --- a/py-json/realm.py +++ b/py-json/realm.py @@ -1166,6 +1166,32 @@ class L3CXProfile(BaseProfile): raise ValueError('Filename %s does not match output format %s' % (report_file, output_format)) else: output_format = report_file.split('.')[-1] + #retrieve compared report if specified - turn into dataframe + if compared_report is not None: + compared_format = compared_report.split('.')[-1] + #initial dataframe + previous_data_df = pd.DataFrame() + if compared_format == 'hdf': + #df.to_hdf(report_file, 'table', append=True) + continue + if compared_format == 'parquet': + #df.to_parquet(report_file, engine='pyarrow') + continue + if compared_format == 'png': + #fig = df.plot().get_figure() + #fig.savefig(report_file) + continue + if compared_format.lower() in ['excel', 'xlsx'] or report_file.split('.')[-1] == 'xlsx': + continue + if compared_format == 'df': + #return df + continue + supported_formats = ['csv', 'json', 'stata', 'pickle','html'] + for format in supported_formats: + if compared_format.lower() == format: + # exec('df.to_' + x + '("' + report_file + '",index=False' + ')') + previous_data_df= read_csv() + # Step 1, column names fields=None diff --git a/py-scripts/test_ipv4_variable_time.py b/py-scripts/test_ipv4_variable_time.py index d642e7db..7edc3994 100755 --- a/py-scripts/test_ipv4_variable_time.py +++ b/py-scripts/test_ipv4_variable_time.py @@ -168,7 +168,8 @@ python3 ./test_ipv4_variable_time.py --b_min 1000 --ap "00:0e:8e:78:e1:76" --output_format csv - --report_file ~/Documents/results.csv (if csv file - please use another extension for other files) + --report_file ~/Documents/results.csv (Example of csv file output - please use another extension for other files) + --compared_report ~/Documents/results_prev.csv (Example of csv file retrieval - please use another extension for other files) --debug ''')