diff --git a/src/pages/2-model_creation.py b/src/pages/2-model_creation.py index 866dfe91d011193c84472050b3bb56c7daf4136e..626008c5bfa9c07c5d1a2d444d54869a8cb0ed18 100644 --- a/src/pages/2-model_creation.py +++ b/src/pages/2-model_creation.py @@ -60,8 +60,10 @@ if file == files_format[0]: ycal_csv = M00.file_uploader("Select corresponding Chemical Data", type="csv", help=" :mushroom: select a csv matrix with samples as rows and chemical values as a column") if ycal_csv: - sepy = M00.radio("separator (Y file): ", options=[";", ","], key=2) - hdry = M00.radio("samples name (Y file)?: ", options=["no", "yes"], key=3) + sepy = M00.radio("Select separator (Y file) - _detected_: " + str(find_delimiter('data/'+ycal_csv.name)), + options=[";", ","], index=[";", ","].index(str(find_delimiter('data/'+ycal_csv.name))), key=2) + hdry = M00.radio("samples name (Y file)? - _detected_: " + str(find_col_index('data/'+ycal_csv.name)), + options=["no", "yes"], index=["no", "yes"].index(str(find_col_index('data/'+ycal_csv.name))), key=3) if hdry == "yes": col = 0 else: col = False else: @@ -71,15 +73,14 @@ if file == files_format[0]: file_name = str(xcal_csv.name) +' and '+ str(ycal_csv.name) xfile = pd.read_csv(xcal_csv, decimal='.', sep=sepx, index_col=col, header=0) yfile = pd.read_csv(ycal_csv, decimal='.', sep=sepy, index_col=col) - if yfile.shape[1]>0 and xfile.shape[1]>0 : spectra, meta_data = col_cat(xfile) - y, idx = col_cat(yfile) - if y.shape[1]>1: - yname = M00.selectbox('Select target', options=y.columns) - y = y.loc[:,yname] + chem_data, idx = col_cat(yfile) + if chem_data.shape[1]>1: + yname = M00.selectbox('Select target', options=chem_data.columns) + y = chem_data.loc[:,yname] else: - y = y.iloc[:,0] + y = chem_data.iloc[:,0] spectra = pd.DataFrame(spectra).astype(float)