脚本
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"c:\\Users\\admin\\.conda\\envs\\F6processing\\lib\\site-packages\\numpy\\_distributor_init.py:30: UserWarning: loaded more than 1 DLL from .libs:\n",
|
||||
"c:\\Users\\admin\\.conda\\envs\\F6processing\\lib\\site-packages\\numpy\\.libs\\libopenblas.EL2C6PLE4ZYW3ECEVIV3OXXGRN2NRFM2.gfortran-win_amd64.dll\n",
|
||||
"c:\\Users\\admin\\.conda\\envs\\F6processing\\lib\\site-packages\\numpy\\.libs\\libopenblas64__v0.3.21-gcc_10_3_0.dll\n",
|
||||
" warnings.warn(\"loaded more than 1 DLL from .libs:\"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"11月—维修产值财务审统计表(汇总)已删除需减产值的.xls\n",
|
||||
"4月维修产值财务审统计表(汇总).xls\n",
|
||||
"5月产值同捷+畅天.xls\n",
|
||||
"报表---维修产值财务审统计表.xls\n",
|
||||
"报表--维修产值财务审统计表.xls\n",
|
||||
"报表-维修产值财务审统计表--汇总.xls\n",
|
||||
"报表-维修产值财务审统计表-汇总.xls\n",
|
||||
"报表-维修产值财务审统计表.xls\n",
|
||||
"报表-维修产值财务审统计表0228.xls\n",
|
||||
"报表-维修产值财务审统计表10..xls\n",
|
||||
"报表-维修产值财务审统计表10.xls\n",
|
||||
"报表-维修产值财务审统计表11.xls\n",
|
||||
"报表-维修产值财务审统计表12月.xls\n",
|
||||
"报表-维修产值财务审统计表2019.xls\n",
|
||||
"报表-维修产值财务审统计表202101.xls\n",
|
||||
"报表-维修产值财务审统计表2021年9月.xls\n",
|
||||
"报表-维修产值财务审统计表202201.xls\n",
|
||||
"报表-维修产值财务审统计表331.xls\n",
|
||||
"报表-维修产值财务审统计表3月.xls\n",
|
||||
"报表-维修产值财务审统计表5.xls\n",
|
||||
"报表-维修产值财务审统计表6.xls\n",
|
||||
"报表-维修产值财务审统计表7.xls\n",
|
||||
"报表-维修产值财务审统计表8.xls\n",
|
||||
"报表-维修产值财务审统计表9.xls\n",
|
||||
"报表-维修产值财务审统计表—12月汇总.xls\n",
|
||||
"汇总----维修产值财务审统计表.xls\n",
|
||||
"汇总-维修产值财务审统计表.xls\n",
|
||||
"汇总-维修产值财务审统计表2月.xls\n",
|
||||
"汇总6月报表-维修产值财务审统计表.xls\n",
|
||||
"汇总7月报表-维修产值财务审统计表.xls\n",
|
||||
"汇总报表-维修产值财务审统计表.xls\n",
|
||||
"汇总报表.-维修产值财务审统计表.xls\n",
|
||||
"维修产值财务审统计表-2月.xls\n",
|
||||
"维修产值财务审统计表—10月汇总.xls\n",
|
||||
"维修产值财务审统计表—汇总.xls\n",
|
||||
"!维修产值财务审统计表-汇总一下.xls\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<ipython-input-1-225ed455547c>:18: UserWarning: Pandas requires version '1.4.3' or newer of 'xlsxwriter' (version '1.3.8' currently installed).\n",
|
||||
" merged_df.to_excel(output_file, index=False)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import pandas as pd\n",
|
||||
"import os\n",
|
||||
"\n",
|
||||
"folder_path = r'C:\\Users\\admin\\Desktop\\历史记录(1)\\产值'\n",
|
||||
"excel_files = [f for f in os.listdir(folder_path) if f.endswith('.xlsx') or f.endswith('.xls')]\n",
|
||||
"\n",
|
||||
"# 读取每个Excel文件并将其存储在一个列表中\n",
|
||||
"dataframes = []\n",
|
||||
"for file in excel_files:\n",
|
||||
" print(file)\n",
|
||||
" file_path = os.path.join(folder_path, file)\n",
|
||||
" df = pd.read_excel(file_path)\n",
|
||||
" dataframes.append(df)\n",
|
||||
"\n",
|
||||
"merged_df = pd.concat(dataframes, ignore_index=True)\n",
|
||||
"\n",
|
||||
"output_file = '合并后产值.xlsx'\n",
|
||||
"merged_df.to_excel(output_file, index=False)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "F6processing",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in New Issue
Block a user