tianyun %!s(int64=2) %!d(string=hai) anos
pai
achega
726a5f7f6a
Modificáronse 1 ficheiros con 17 adicións e 0 borrados
  1. 17 0
      tmp/excel/excel_tmp.py

+ 17 - 0
tmp/excel/excel_tmp.py

@@ -0,0 +1,17 @@
+import pandas as pd
+
+# 读取Excel文件
+excel_file = pd.ExcelFile('/Users/alvin/Downloads/元数据字段级记录.xlsx')
+
+# 读取指定表格名称的数据
+df = pd.read_excel(excel_file, '元数据字段级记录')
+
+# 输出表头名称
+print(list(df.columns))
+
+# 输出指定表头的去重数据
+# 根据多个字段去重
+df = df.drop_duplicates(subset=['数据表中文名', '字段名称'])
+
+# 将新的表格存入tmp.xlsx文件中
+df.to_excel('tmp.xlsx', index=False)