Explorar el Código

fix: handle CSV encoding issues with custom read_csv utility

mrh (aider) hace 1 año
padre
commit
a720f9fff4
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      mylib/translate_utils.py

+ 3 - 2
mylib/translate_utils.py

@@ -134,8 +134,9 @@ def main():
     input_file = output_dir/"测试.csv"
     output_file = output_dir/"processed_测试.csv"
     
-    # 读取CSV文件
-    df = pd.read_csv(input_file)
+    # 使用自定义编码检测读取CSV文件
+    data = read_csv(input_file)
+    df = pd.DataFrame(data[1:], columns=data[0])
     
     # 提取列数据
     extract_column_data(df, '搜索词')