From ecfb5906ccc3012f819df598892ba44916684853 Mon Sep 17 00:00:00 2001 From: Muhammad Abdelhamid <34060563+Ozzstein@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:00:45 +0200 Subject: [PATCH] Update PyEIS_Data_extraction.py Added try and except statement to handel data exported with "," as decimal sign instead of"." --- PyEIS/PyEIS_Data_extraction.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PyEIS/PyEIS_Data_extraction.py b/PyEIS/PyEIS_Data_extraction.py index 07dc955..c5104b0 100644 --- a/PyEIS/PyEIS_Data_extraction.py +++ b/PyEIS/PyEIS_Data_extraction.py @@ -100,7 +100,10 @@ def extract_mpt(path, EIS_name): for j in range(len(EIS_test_header_names.columns)): names_EIS.append(correct_text_EIS(EIS_test_header_names.columns[j])) #reads coloumn text # return pd.read_csv(path+EIS_name, sep='\t', skiprows=int(EIS_init.err[0][18:20]), names=names_EIS, encoding='latin1') - return pd.read_csv(path+EIS_name, sep='\t', skiprows=int(EIS_init.err[0][18:-1]), names=names_EIS, encoding='latin1') + try: + return pd.read_csv(path+EIS_name, sep='\t', skiprows=int(EIS_init.err[0][18:-1]), names=names_EIS, encoding='latin1') + else: + return pd.read_csv(path+EIS_name, sep='\t', decimal=',', skiprows=int(EIS_init.err[0][18:-1]), names=names_EIS, encoding='latin1') def extract_dta(path, EIS_name): ''' @@ -144,4 +147,4 @@ def extract_solar(path, EIS_name): # #print() -#print('---> Data Extraction Script Loaded (v. 0.0.2 - 06/27/18)') \ No newline at end of file +#print('---> Data Extraction Script Loaded (v. 0.0.2 - 06/27/18)')