""" Created By: ishwor subedi Date: 2024-10-04 """ import pandas as pd def csv_read_batch_code(dataframe): dataframe.dropna() dataframe['Logic ID'].unique() unique_value_indices = {} for logic_id in dataframe['Logic ID'].unique(): row_indices = dataframe[dataframe['Logic ID'] == logic_id].index.tolist() unique_value_indices[logic_id] = [min(row_indices), max(row_indices)] print(unique_value_indices) code_dict = {} for logic_id, (min_row, max_row) in unique_value_indices.items(): codes = dataframe.loc[min_row:max_row, 'Code'].tolist() code_dict[logic_id] = codes return code_dict