2021年1月16日星期六

Cannot assign to function call when looping through and converting excel files

With this code:

    xls = pd.ExcelFile('test.xlsx')      sn = xls.sheet_names      for i,snlist in list(zip(range(1,13),sn)):          'df{}'.format(str(i)) =  pd.read_excel('test.xlsx',sheet_name=snlist, skiprows=range(6))  

I get this error:

'df{}'.format(str(i)) = pd.read_excel('test.xlsx',sheet_name=snlist, skiprows=range(6)) ^ SyntaxError: cannot assign to function call

I can't understand the error and how solve. What's the problem?
df+str(i) also return error

i want to make result as: df1 = pd.read_excel.. list1... df2 = pd.read_excel... list2....

https://stackoverflow.com/questions/65756814/cannot-assign-to-function-call-when-looping-through-and-converting-excel-files January 17, 2021 at 10:39AM

没有评论:

发表评论