Compare commits
No commits in common. "70ed1f85a8d5493422466030c3a1cd88d6e1a50a" and "1f1fbe044b804d2d1aa01119ad293c1a7d568c42" have entirely different histories.
70ed1f85a8
...
1f1fbe044b
20
analysis.py
20
analysis.py
|
|
@ -13,22 +13,12 @@ sheet4 = workbook.parse('中央国家行政机关参照公务员法管理事业
|
||||||
def find_environment_rows(sheet):
|
def find_environment_rows(sheet):
|
||||||
return sheet[sheet['专业'].str.contains('环境科学')]
|
return sheet[sheet['专业'].str.contains('环境科学')]
|
||||||
|
|
||||||
def find_ecology_rows(sheet):
|
|
||||||
return sheet[sheet['专业'].str.contains("生态")]
|
|
||||||
|
|
||||||
# 在新工作表中合并包含环境科学的行
|
# 在新工作表中合并包含环境科学的行
|
||||||
# environment_rows = pd.concat([find_environment_rows(sheet1), find_environment_rows(sheet2),
|
environment_rows = pd.concat([find_environment_rows(sheet1), find_environment_rows(sheet2),
|
||||||
# find_environment_rows(sheet3), find_environment_rows(sheet4)])
|
find_environment_rows(sheet3), find_environment_rows(sheet4)])
|
||||||
|
|
||||||
ecology_rows = pd.concat([find_ecology_rows(sheet1), find_ecology_rows(sheet2),
|
|
||||||
find_ecology_rows(sheet3), find_ecology_rows(sheet4)])
|
|
||||||
|
|
||||||
# 创建一个新的工作薄并将结果写入其中
|
# 创建一个新的工作薄并将结果写入其中
|
||||||
# with pd.ExcelWriter('environment_data.xlsx', engine='openpyxl') as writer:
|
with pd.ExcelWriter('environment_data.xlsx', engine='openpyxl') as writer:
|
||||||
# environment_rows.to_excel(writer, sheet_name='Environment Data', index=False)
|
environment_rows.to_excel(writer, sheet_name='Environment Data', index=False)
|
||||||
|
|
||||||
|
print("包含环境科学的行已写入新工作薄 'environment_data.xlsx'")
|
||||||
with pd.ExcelWriter('ecology_data.xlsx', engine='openpyxl') as writer:
|
|
||||||
ecology_rows.to_excel(writer, sheet_name='ecology Data', index=False)
|
|
||||||
|
|
||||||
# print("包含环境科学的行已写入新工作薄 'environment_data.xlsx'")
|
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue