对于一个excel表格,名称为“数据库结构”
目标:python读取并转化为列表
import pandas as pd
df = pd.read_excel('数据库结构.xlsx')
data=df.loc[:,['一级','二级', 'url']] # 取所有的行,列取['一级','二级', 'url']
df_list = df.values.tolist() # dateframe 转 list
print(df_list)
输出为
[[1, '眼科', '疾病诊断名词', 'https://cscd.yadingdata.com/api/csbd/category/1/children'],
[2, '眼科', '症状体征名词', 'https://cscd.yadingdata.com/api/csbd/category/2/children'],
[3, '眼科', '手术操作名词', 'https://cscd.yadingdata.com/api/csbd/category/3/children'],
[4, '眼科', '临床检查名词', 'https://cscd.yadingdata.com/api/csbd/category/4/children']]