Python 3.x Dataframe to_excel方法不创建包含Dataframe内容的工作簿
我正在使用Python3.8并创建了一个简单的脚本来从JIRA中提取问题,旨在通过数据框架导出到Excel。我可以在终端上完美地打印数据框内容,但是当尝试将数据框导出到Excel时,它不会生成,尽管我没有收到任何错误!下面是我的python源代码摘录。(熊猫版本=1.1.4)非常感谢Python 3.x Dataframe to_excel方法不创建包含Dataframe内容的工作簿,python-3.x,pandas,dataframe,Python 3.x,Pandas,Dataframe,我正在使用Python3.8并创建了一个简单的脚本来从JIRA中提取问题,旨在通过数据框架导出到Excel。我可以在终端上完美地打印数据框内容,但是当尝试将数据框导出到Excel时,它不会生成,尽管我没有收到任何错误!下面是我的python源代码摘录。(熊猫版本=1.1.4)非常感谢 import pandas as pd from jira.client import JIRA ..... ..... jiraissues = jc.search_issues(query1, 0, block
import pandas as pd
from jira.client import JIRA
.....
.....
jiraissues = jc.search_issues(query1, 0, block_size)
print(len(jiraissues)) # of issues found (I get 45 for the particular query)
issuesdf = pd.DataFrame()
for issue in jiraissues:
#add jira data to dictionary
d= {
'key': issue.key,
'type': issue.fields.issuetype,
'created': issue.fields.created,
'updated': issue.fields.updated,
'summary': issue.fields.summary,
'status': issue.fields.status
}
issuesdf=issuesdf.append(d,ignore_index=True)
print(issuesdf) #--this prints DataFrame contents correctly (52 rows x 15 columns)
writer = pd.ExcelWriter('JiraExport.xlsx')
issuesdf.to_excel(writer, sheet_name='Sheet1') #Excel workbook 'JiraExport.xlsx' is not generated and hence not listed in the file explorer anywhere
writer.save
如果你在没有作者的情况下做这件事行得通吗?e、 g.
issuesdf.to_excel('JiraExport.xlsx')
并且.to_csv()
或其他编写器工作吗?看起来您没有正确定义编写器。这在@kfinity中奏效了!我花了很多时间找出了根本原因,非常感谢你的迅速反应!如果你在没有作者的情况下做这件事行得通吗?e、 g.issuesdf.to_excel('JiraExport.xlsx')
并且.to_csv()
或其他编写器工作吗?看起来您没有正确定义编写器。这在@kfinity中奏效了!我花了很多时间找出了根本原因,非常感谢你的迅速反应!