122 lines
4.7 KiB
Plaintext
122 lines
4.7 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"metadata": {},
|
|
"cell_type": "markdown",
|
|
"source": "### 最终结果标注审批流程",
|
|
"id": "cdf6fcc2ebcee12"
|
|
},
|
|
{
|
|
"metadata": {
|
|
"ExecuteTime": {
|
|
"end_time": "2025-05-14T02:57:33.850482Z",
|
|
"start_time": "2025-05-14T02:57:25.398008Z"
|
|
}
|
|
},
|
|
"cell_type": "code",
|
|
"source": [
|
|
"import pandas as pd\n",
|
|
"from tqdm import tqdm\n",
|
|
"\n",
|
|
"df_final = pd.read_csv(\"审批流程分类结果.csv\")\n",
|
|
"\n",
|
|
"result_rows = []\n",
|
|
"for index, row in df_final.iterrows():\n",
|
|
" base_info = {'group_id': row[\"group_id\"]}\n",
|
|
" process_id_list = []\n",
|
|
" process_list = []\n",
|
|
" for i in range(1, 10):\n",
|
|
" prefix = f'审批{i}'\n",
|
|
" if row[f'{prefix}流程节点id'] != \"-\":\n",
|
|
" process_id = row[f'{prefix}流程节点id']\n",
|
|
" process_id_list.append(process_id)\n",
|
|
" if row[f'{prefix}节点名'] != \"-\":\n",
|
|
" process = row[f'{prefix}节点名']\n",
|
|
" process_list.append(process)\n",
|
|
"\n",
|
|
"\n",
|
|
" for i in range(1, 10): # 审批1到审批n\n",
|
|
" prefix = f'审批{i}'\n",
|
|
" approval_data = {}\n",
|
|
" if f'{prefix}时间' in df_final.columns and pd.notna(row[f'{prefix}时间']) and row[f'{prefix}时间'] != '-':\n",
|
|
" approval_data = {\n",
|
|
" '审批时间': row[f'{prefix}时间'],\n",
|
|
" '审批节点名': row[f'{prefix}节点名'],\n",
|
|
" '审批人': row[f'{prefix}人'],\n",
|
|
" '审批动作': row[f'{prefix}动作'],\n",
|
|
" '序号': row[f'序号{i}'] if f'序号{i}' in df_final.columns else '-',\n",
|
|
" f'审批数据id': row[f'审批{i}数据id'] if f'审批{i}数据id' in df_final.columns else '-',\n",
|
|
" f'审批流程版本': row[f'审批{i}流程版本'] if f'审批{i}流程版本' in df_final.columns else '-',\n",
|
|
" f'审批流程节点id': row[f'审批{i}流程节点id'] if f'审批{i}流程节点id' in df_final.columns else '-',\n",
|
|
" f'审批节点id合并': process_id_list,\n",
|
|
" f'审批节点名合并': process_list\n",
|
|
" }\n",
|
|
" # 合并基础数据和审批数据\n",
|
|
" result_row = {**base_info, **approval_data}\n",
|
|
" result_rows.append(result_row)\n",
|
|
"dfn = pd.DataFrame(result_rows)\n",
|
|
"dfn.to_csv(\"审批流程分类结果_with_node_name123.csv\", index=False)"
|
|
],
|
|
"id": "6968172b4dfe06bc",
|
|
"outputs": [
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"C:\\Users\\Administrator.DESKTOP-7IC2USJ\\AppData\\Local\\Temp\\ipykernel_14552\\122128465.py:4: DtypeWarning: Columns (20,22) have mixed types. Specify dtype option on import or set low_memory=False.\n",
|
|
" df_final = pd.read_csv(\"审批流程分类结果.csv\")\n"
|
|
]
|
|
}
|
|
],
|
|
"execution_count": 8
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"id": "initial_id",
|
|
"metadata": {
|
|
"collapsed": true,
|
|
"ExecuteTime": {
|
|
"end_time": "2025-04-28T03:12:03.680845Z",
|
|
"start_time": "2025-04-28T03:12:03.661193Z"
|
|
}
|
|
},
|
|
"source": "",
|
|
"outputs": [
|
|
{
|
|
"ename": "ImportError",
|
|
"evalue": "cannot import name 'API' from 'api' (D:\\Idea Project\\F6+宜搭+其它(1)\\new\\SasS日常回访\\api\\__init__.py)",
|
|
"output_type": "error",
|
|
"traceback": [
|
|
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
|
|
"\u001B[1;31mImportError\u001B[0m Traceback (most recent call last)",
|
|
"Cell \u001B[1;32mIn[2], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mapi\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m API\n\u001B[0;32m 2\u001B[0m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;21;01mpandas\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m \u001B[38;5;21;01mpd\u001B[39;00m\n\u001B[0;32m 4\u001B[0m api_instance \u001B[38;5;241m=\u001B[39m API()\n",
|
|
"\u001B[1;31mImportError\u001B[0m: cannot import name 'API' from 'api' (D:\\Idea Project\\F6+宜搭+其它(1)\\new\\SasS日常回访\\api\\__init__.py)"
|
|
]
|
|
}
|
|
],
|
|
"execution_count": 2
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 2
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython2",
|
|
"version": "2.7.6"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|