def tasks_to_spreadsheet(tasks, filepath):
import pandas
df_tasks = pandas.DataFrame.from_records([
task.to_dict()
for task in tasks
])
resources = set(resource for task in tasks for resource in task.resources)
df_resources = pandas.DataFrame.from_records([
resource.to_dict()
for resource in resources
])
with pandas.ExcelWriter(filepath, engine='xlsxwriter') as writer:
df_tasks.to_excel(writer, sheet_name='tasks', index=False)
df_resources.to_excel(writer, sheet_name='resources', index=False)
评论列表
文章目录