Quellcode durchsuchen

refactor: remove header row adjustment and comment out test code

mrh vor 10 Monaten
Ursprung
Commit
5c711a7083
1 geänderte Dateien mit 10 neuen und 18 gelöschten Zeilen
  1. 10 18
      function_calling/excel_processor.py

+ 10 - 18
function_calling/excel_processor.py

@@ -199,14 +199,6 @@ class ExcelProcessor:
             
             # 插入新列
             df.insert(insert_index, new_column_name, '')
-            
-            # 调整表头行数据
-            if self.header_row > 0:
-                # 将新列的表头行设置为空
-                df.iloc[:self.header_row, insert_index] = ''
-                # 在表头行设置新列名
-                df.iloc[self.header_row, insert_index] = new_column_name
-            
             logger.info(f"成功在列 '{ref_column}' 的 '{position}' 插入新列 '{new_column_name}'")
             return df
             
@@ -221,17 +213,17 @@ if __name__ == '__main__':
     processor.insert_column('B', '翻译结果')
     
     # 测试搜索表头
-    matches = processor.search_headers(['类别', '搜索词'])
-    ref_column_list = [match[1] for match in matches]
-    print(f"找到的匹配列: {matches}")
-    logger.info(f"找到的匹配列号: {ref_column_list}")
+    # matches = processor.search_headers(['类别', '搜索词'])
+    # ref_column_list = [match[1] for match in matches]
+    # print(f"找到的匹配列: {matches}")
+    # logger.info(f"找到的匹配列号: {ref_column_list}")
     
-    # 测试读取列数据
-    data = processor.read_column_data('B')
-    print(f"读取到的数据: {data}")
+    # # 测试读取列数据
+    # data = processor.read_column_data('B')
+    # print(f"读取到的数据: {data}")
     
-    # 测试写入列数据
-    new_data = ['新数据1', '新数据2', '新数据3']
-    processor.write_column_data('C', new_data)
+    # # 测试写入列数据
+    # new_data = ['新数据1', '新数据2', '新数据3']
+    # processor.write_column_data('C', new_data)
     
     processor.save_file('/home/mrh/code/excel_tool/temp/测试_process.csv')