python读取excel处理完的数据生成的csv文件,为啥只有1列数据

import pandas as pd

f = open(\u0026#39;E:/Data/data.txt\u0026#39;)
stock =
for line in f.readlines():
line = line.replace(\u0026#39;\\u0026#39;,\u0026#39;\u0026#39;)
stock.append(line)
f.close()

for each in stock:
filePath = "E:/Data/"+each+".xlsx"
wb = openpyxl.load_workbook(filename=filePath)
ws = wb.active
sheets = wb.get_sheet_names()
【python读取excel处理完的数据生成的csv文件,为啥只有1列数据】 #财务数据
current_assets = ws.cell(row=20,column=2).value #流动资产
current_liabilities = ws.cell(row=60,column=2).value #流动负债
total_assets = ws.cell(row=42,column=2).value #总资产
gross_liability = ws.cell(row=72,column=2).value #总负债
surplus_public_accumulation = ws.cell(row=79,column=2).value #盈余公积
undistributed_profit = ws.cell(row=81,column=2).value #未分配利润
PBT = ws.cell(row=103,column=2).value #税前利润
interests = ws.cell(row=93,column=2).value #利息
owners_equity = ws.cell(row=84,column=2).value #所有者权益
sales_revenue = ws.cell(row=87,column=2).value #销售收入
selling_cost = ws.cell(row=89,column=2).value #销售成本
end_receivable = ws.cell(row=8,column=2).value #期末应收账款
beginning_receivable = ws.cell(row=8,column=3).value #期初应收账款
end_notes_receivable = ws.cell(row=7,column=2).value #期末应收票据
beginning_notes_receivable = ws.cell(row=7,column=3).value #期初应收票据
end_inventory = ws.cell(row=14,column=2).value #期末存货
beginning_inventory = ws.cell(row=14,column=3).value #期初存货
end_accounts_payable = ws.cell(row=47,column=2).value #期末应付账款
beginning_accounts_payable = ws.cell(row=47,column=3).value #期初应付账款
#财务数据\u0026amp;公式
Data_x1 = (current_assets-current_liabilities)/total_assets #营运资本/总资产 ,反映长期经营亏损的公司,其净流动资产相对于总资产将有所缩减
Data_x2 = (surplus_public_accumulation+undistributed_profit)/total_assets #留存收益/总资产 ,反映公司的存续时间
Data_x3 = (PBT+interests)/total_assets #息税前利润/总资产 ,公司资产真实获利能力
Data_x4 = owners_equity/gross_liability #权益的账面价值/总债务 ,反映公司资不抵债前,其资产能够下降多少
Data_x5 = sales_revenue/total_assets #销售收入/总资产,反映公司资产营运能力,衡量企业在竞争状态下的管理能力
#创建的字典
Data_all=
df1 =pd.DataFrame(Data_all,columns=)
df1.to_csv(\u0026#39;C:/Users/htt/Desktop/stock/test1.csv\u0026#39;)

print("------------end-------------")

第一次提问,我把代码复制出来了

■网友
贴图片的提问,得到回答的机会就会减少。


    推荐阅读