2 Commits 467b4a4186 ... f051a56670

Author SHA1 Message Date
  wxz f051a56670 提取表格数据 3 weeks ago
  wxz 20b4f9896c 提取表格数据 3 weeks ago
1 changed files with 20 additions and 0 deletions
  1. 20 0
      data/analyze_data/analyze_xls.py

+ 20 - 0
data/analyze_data/analyze_xls.py

@@ -0,0 +1,20 @@
+import pandas as pd
+
+def readXls(path):
+    # 读取xls文件
+    df = pd.read_excel(path)
+
+    # 分隔
+    df.iloc[:, 0] = df.iloc[:, 0].astype(str).str.split('+')
+    df.iloc[:, 2] = df.iloc[:, 2].astype(str).str.split('/')
+    df.iloc[:, 4] = df.iloc[:, 4].astype(str).str.split('/')
+    df.iloc[:, 6] = df.iloc[:, 6].astype(str).str.split('/')
+
+    # 将DataFrame数据转换为字典列表
+    data_list = df.to_dict('records')
+
+    return data_list
+
+
+
+