diff --git a/体测单位/北海炼化.ipynb b/体测单位/北海炼化.ipynb index 819ba29..9c2345c 100644 --- a/体测单位/北海炼化.ipynb +++ b/体测单位/北海炼化.ipynb @@ -4,6 +4,7 @@ "cell_type": "markdown", "id": "1c72f0cf-165b-4025-af9d-6771e4a0a5d1", "metadata": { + "jp-MarkdownHeadingCollapsed": true, "tags": [], "toc-hr-collapsed": true }, @@ -648,7 +649,10 @@ { "cell_type": "markdown", "id": "1ab2aa22-5cc2-4f53-a28d-b30b1ecab15f", - "metadata": {}, + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, "source": [ "## 人员信息处理" ] @@ -1103,15 +1107,15 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 8, "id": "0bafbf66-c909-413e-a9c1-c1a5f9c22953", "metadata": { "execution": { - "iopub.execute_input": "2023-11-06T02:24:15.934701Z", - "iopub.status.busy": "2023-11-06T02:24:15.934225Z", - "iopub.status.idle": "2023-11-06T02:24:16.060592Z", - "shell.execute_reply": "2023-11-06T02:24:16.060193Z", - "shell.execute_reply.started": "2023-11-06T02:24:15.934664Z" + "iopub.execute_input": "2023-11-06T02:45:26.997902Z", + "iopub.status.busy": "2023-11-06T02:45:26.997635Z", + "iopub.status.idle": "2023-11-06T02:45:27.153980Z", + "shell.execute_reply": "2023-11-06T02:45:27.153516Z", + "shell.execute_reply.started": "2023-11-06T02:45:26.997879Z" }, "tags": [] }, @@ -1160,15 +1164,15 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 9, "id": "ff1e0a37-6119-4f64-8e05-4d25cb144817", "metadata": { "execution": { - "iopub.execute_input": "2023-11-06T02:24:19.656268Z", - "iopub.status.busy": "2023-11-06T02:24:19.655917Z", - "iopub.status.idle": "2023-11-06T02:24:19.664523Z", - "shell.execute_reply": "2023-11-06T02:24:19.664185Z", - "shell.execute_reply.started": "2023-11-06T02:24:19.656254Z" + "iopub.execute_input": "2023-11-06T02:45:31.688480Z", + "iopub.status.busy": "2023-11-06T02:45:31.688086Z", + "iopub.status.idle": "2023-11-06T02:45:31.699445Z", + "shell.execute_reply": "2023-11-06T02:45:31.699024Z", + "shell.execute_reply.started": "2023-11-06T02:45:31.688449Z" }, "tags": [] }, @@ -1203,10 +1207,90 @@ "print('ok')" ] }, + { + "cell_type": "markdown", + "id": "405f3461-fcef-47d4-a88b-a2975f8d522f", + "metadata": {}, + "source": [ + "## 获取人员测试成绩" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "1aa45b35-7376-4c50-8275-79b090a6c758", + "metadata": { + "execution": { + "iopub.execute_input": "2023-11-06T11:49:54.423587Z", + "iopub.status.busy": "2023-11-06T11:49:54.423105Z", + "iopub.status.idle": "2023-11-06T11:49:54.446801Z", + "shell.execute_reply": "2023-11-06T11:49:54.446345Z", + "shell.execute_reply.started": "2023-11-06T11:49:54.423549Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "88\n", + "88\n" + ] + } + ], + "source": [ + "import json\n", + "import time\n", + "import csv\n", + "\n", + "filename = '../item.json'\n", + "item = {}\n", + "unit = {}\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "for k,v in dict1.items():\n", + " item[k] = v\n", + "re_ta = {}\n", + "dict1 = {}\n", + "list1 = []\n", + "filename = 'data/北海炼化2023年.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "\n", + "filename = 'data/places_result_20231106.csv'\n", + "with open(filename,'r',newline='') as csv_file:\n", + " fl = csv.reader(csv_file,delimiter=',')\n", + " header = next(fl) \n", + " for line in fl:\n", + " #line = re.sub('[\\r\\n\\f ]{1,}', '', line)\n", + " list1.append(line)\n", + "#print(list1)\n", + "for result in list1:\n", + " user = str(result[2])\n", + " if user in dict1.keys(): \n", + " m_item = str(result[3]) \n", + " re_ta.setdefault(user,{}) \n", + " re_ta[user]['name'] = dict1[user]['name']\n", + " re_ta[user]['sex'] = dict1[user]['sex'] \n", + " re_ta[user]['unit'] = dict1[user]['unit']\n", + " item_name = item[m_item]['name']\n", + " re_ta[user].setdefault(item_name,{}) \n", + " score = int(result[4])/item[m_item]['divisor'] \n", + " re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n", + " re_ta[user]['rq'] = str(result[6]) \n", + "print(len(re_ta))\n", + "filename = 'data/result_北海炼化2023.json'\n", + "\n", + "with open(filename,'w') as fl:\n", + " json.dump(re_ta, fl, ensure_ascii=False) \n", + "print(len(re_ta))" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "43af17bf-d80a-4c04-8bb3-25c192c9443f", + "id": "56ad2623-c435-4161-a55e-18899c6134ea", "metadata": {}, "outputs": [], "source": []