首页 > 解决方案 > Python-遍历多个文件以读入数据框

问题描述

这是工作代码:

from urllib.request import urlretrieve 
import requests
import xlrd
import pandas as pd

工作代码

icd9_link = "https://www.cob.cms.hhs.gov/Section111/assets/section111/Section111ValidICD9-2017.xlsx"
icd9_map= pd.read_excel(icd9_link, sheet_name=0, header=0)

不工作的代码

定义将命名 ICD_9_map_ 并使用正确链接的函数

fx =  icd"{0}"_map_= pd.read_excel(icd"{1}"_link,    sheet_name=0, header=0)

#

y = [9,10]
  for x in y:
   fx.format(x, x) 

标签: python-3.x

解决方案


推荐阅读