This commit is contained in:
512song committed 2023-04-30 11:18:07 +08:00
1 parent f03e964585
commit 5ac233adcc
4 files changed
+574 -141

No files matched your search

+102 -10
View File
@@ -10,12 +10,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "1144aaac-92a0-4bcf-aba7-096f7dd3ad3b",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-28T08:05:05.494533Z",
"iopub.status.busy": "2023-04-28T08:05:05.494066Z",
"iopub.status.idle": "2023-04-28T08:05:06.489698Z",
"shell.execute_reply": "2023-04-28T08:05:06.488731Z",
"shell.execute_reply.started": "2023-04-28T08:05:05.494503Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
@@ -43,6 +58,60 @@
"print('ok')"
]
},
{
"cell_type": "markdown",
"id": "93b9bfba-5404-4c9b-ac8f-48a3bf296669",
"metadata": {},
"source": [
"## 合并人员信息"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "d5171966-95ae-47ae-a75e-db08de772348",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-28T08:30:24.695022Z",
"iopub.status.busy": "2023-04-28T08:30:24.694269Z",
"iopub.status.idle": "2023-04-28T08:30:24.860969Z",
"shell.execute_reply": "2023-04-28T08:30:24.859964Z",
"shell.execute_reply.started": "2023-04-28T08:30:24.694992Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import json\n",
"filename = 'data/天津石化人员名单.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/天津石化人员231113_1.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
"\n",
"for k, v in dict2.items():\n",
" if k not in dict1.keys():\n",
" dict1.setdefault(k,{})\n",
" dict1[k]['name'] = dict2[k]['name']\n",
" dict1[k]['sex'] = dict2[k]['sex']\n",
" dict1[k]['unit'] = dict2[k]['name']\n",
" dict1[k]['sub_unit'] = dict2[k]['sub_unit']\n",
"filename = 'data/天津石化人员名单.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n",
"print('ok')"
]
},
{
"cell_type": "markdown",
"id": "5e648b69-40bf-4494-9079-e4e2b6ab8866",
@@ -58,7 +127,15 @@
"metadata": {
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import json\n",
"import time\n",
@@ -78,7 +155,7 @@
"dict1 = {}\n",
"list1 = []\n",
"#print(\"\\n运动项目信息:\")\n",
"filename = 'data/134_2210.csv'\n",
"filename = '体测单位/data/20230428_134.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -172,12 +249,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"id": "27529013-f3de-4e23-980d-f62203e4df88",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-30T01:28:04.696517Z",
"iopub.status.busy": "2023-04-30T01:28:04.695670Z",
"iopub.status.idle": "2023-04-30T01:28:06.723602Z",
"shell.execute_reply": "2023-04-30T01:28:06.722564Z",
"shell.execute_reply.started": "2023-04-30T01:28:04.696475Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
@@ -188,13 +280,13 @@
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"del dict1['1730253']\n",
"filename = 'data/天津石化人员名单.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
" \n",
"list1 = []\n",
"for k, v in dict1.items():\n",
" #print(k,dict2[str(k)]['name'])\n",
"for k, v in dict1.items(): #print(k,dict2[str(k)]['name'])\n",
" list2 = []\n",
" list2.append(str(k).rjust(5,'0'))\n",
" list2.append(dict2[k]['name']) \n",
@@ -1449,7 +1541,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -1463,7 +1555,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.10.6"
}
},
"nbformat": 4,