def extract_df_info_ERCZO(csv_file): header = [] units = [] method = [] # get the header and datatypes with open(csv_file, 'rb') as f: lines = f.readlines() header = lines[0].strip().decode().split(',') data = lines[1].strip().decode().split(',') types = [ut.get_type(v) for v in data] # reformat the column names colnames = [] unit_labels = [] for i in range(len(header)): unit_label = header[i][header[i].find("("):header[i].find(")") + 1] unit_labels.append(unit_label) print(header[i]) print(unit_label) u = unit_label if unit_label != '' else 'na' unit_label = u colnames.append(header[i]) return colnames, unit_labels, types, method
def extract_df_info(csv_file): header = [] units = [] method = [] # get the header and datatypes with open(csv_file, 'rb') as f: lines = f.readlines() header = lines[0].strip().decode().split(',') unit_labels = lines[1].strip().decode("windows-1252").split(',') method = lines[3].strip().decode().split(',') data = lines[4].strip().decode().split(',') types = [ut.get_type(v) for v in data] # reformat the column names colnames = [] for i in range(len(header)): u = unit_labels[i] if unit_labels[i] != '' else 'na' unit_labels[i] = u colnames.append('%s (%s)' % (header[i], u)) return colnames, unit_labels, types, method