This commit is contained in:
512song committed 2024-07-03 00:42:14 +08:00
1 parent 5f6011fb86
commit 53b685c6aa
4 files changed
+1058 -620

No files matched your search

+235 -9
View File
@@ -1,5 +1,15 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "d48fc174-4d21-4686-a47f-54596f7d836b",
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# 西藏中石油"
]
},
{
"cell_type": "markdown",
"id": "70c15816-2ad5-4486-be33-378963d70934",
@@ -53,7 +63,9 @@
{
"cell_type": "markdown",
"id": "be805082-d5d7-405b-975c-fb902085a041",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"## 文件更名"
]
@@ -103,7 +115,9 @@
{
"cell_type": "markdown",
"id": "962f6edd-c8d1-42a2-aaff-58f92ccf8d56",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"## 问卷人员信息导入"
]
@@ -165,7 +179,9 @@
{
"cell_type": "markdown",
"id": "25ffcc7a-5709-4377-b821-bce5097cbd78",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"## 导入脊柱问卷信息"
]
@@ -206,7 +222,9 @@
{
"cell_type": "markdown",
"id": "56538b71-aedc-4880-b655-a814778bda07",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"## 导入体测信息"
]
@@ -247,7 +265,9 @@
{
"cell_type": "markdown",
"id": "0a66d37f-6436-4e3c-abe1-d5fd4796e683",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"## 导出手工信息"
]
@@ -337,7 +357,9 @@
{
"cell_type": "markdown",
"id": "3d7ab69c-941d-4f73-8708-2aab850ae2e1",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"## 导入体测信息"
]
@@ -399,7 +421,9 @@
{
"cell_type": "markdown",
"id": "52597677-83a0-447e-95b2-7e8c4296bec7",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"## 报告更名"
]
@@ -1051,10 +1075,212 @@
"#print(dict1) "
]
},
{
"cell_type": "markdown",
"id": "fa57d171-2f81-4e8c-987a-3b49ffefa731",
"metadata": {},
"source": [
"# 西藏双湖"
]
},
{
"cell_type": "markdown",
"id": "bda42b7d-8a5e-4657-9cfa-02689243597b",
"metadata": {},
"source": [
"## 导入人员信息及成绩"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "4393b52c-67f0-447a-a87b-ecc1abd067aa",
"metadata": {
"execution": {
"iopub.execute_input": "2024-07-01T04:05:02.362469Z",
"iopub.status.busy": "2024-07-01T04:05:02.361695Z",
"iopub.status.idle": "2024-07-01T04:05:02.536973Z",
"shell.execute_reply": "2024-07-01T04:05:02.536502Z",
"shell.execute_reply.started": "2024-07-01T04:05:02.362398Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"import datetime\n",
"\n",
"wb = openpyxl.load_workbook('data/双湖县20240524.xlsx')\n",
"sheet = wb['20240525下午']\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"for n in range(1, sheet.max_row+1):\n",
" if sheet.cell(n,2).value is None:\n",
" break\n",
" else: \n",
" code = int(sheet.cell(n, 1).value)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value \n",
" sex = sheet.cell(n, 3).value\n",
" dict1['sex'] = sex\n",
" s= str(sheet.cell(n, 4).value)\n",
" rq = s[:4]+'-'+s[4:6]+'-'+s[6:8]\n",
" dict1['birth'] = rq\n",
" person[code] = dict1\n",
"filename = 'data/双湖0525下午.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print('ok')"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "49e478a0-00c7-47e4-957d-f0826352897b",
"metadata": {
"execution": {
"iopub.execute_input": "2024-07-01T05:04:19.050199Z",
"iopub.status.busy": "2024-07-01T05:04:19.049570Z",
"iopub.status.idle": "2024-07-01T05:04:19.064764Z",
"shell.execute_reply": "2024-07-01T05:04:19.063834Z",
"shell.execute_reply.started": "2024-07-01T05:04:19.050121Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"83\n",
"83\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/双湖0525下午.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20240525_下午.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() and result[7] == '0': \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]['birth'] = dict1[user]['birth']\n",
" re_ta[user]['rq'] = '2024-05-25'\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",
"print(len(re_ta))\n",
"filename = 'data/result_双湖052502.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": "markdown",
"id": "8538d80e-1448-4c13-96ea-8335f9e817eb",
"metadata": {},
"source": [
"## 手工数据录入"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "d313e492-91d0-46c9-bbca-a5d97169e88b",
"metadata": {
"execution": {
"iopub.execute_input": "2024-07-01T12:43:03.605454Z",
"iopub.status.busy": "2024-07-01T12:43:03.604690Z",
"iopub.status.idle": "2024-07-01T12:43:03.654585Z",
"shell.execute_reply": "2024-07-01T12:43:03.654044Z",
"shell.execute_reply.started": "2024-07-01T12:43:03.605382Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"142\n"
]
}
],
"source": [
"import json\n",
"import time\n",
"import csv\n",
"\n",
"\n",
"filename = 'data/result_双湖052403.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"wb = openpyxl.load_workbook('data/双湖手工数据.xlsx')\n",
"sheet = wb['2024052403']\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"for n in range(1, sheet.max_row+1):\n",
" if sheet.cell(n,2).value is None:\n",
" break\n",
" else: \n",
" code = str(sheet.cell(n, 2).value)\n",
" if code in dict1.keys():\n",
" xm = sheet.cell(n, 1).value\n",
" dict1[code].setdefault(xm,{})\n",
" if xm =='体重':\n",
" result = str(sheet.cell(n, 3).value) + ' 千克'\n",
" else:\n",
" result = str(sheet.cell(n, 3).value) + ' 厘米'\n",
" dict1[code][xm]['成绩'] = result\n",
"filename = 'data/result_双湖052403.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False) \n",
"print(len(dict1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2787bc9f-6492-4b51-9b37-87ac098d93b9",
"id": "e745c870-6a5a-4040-a2cf-79e4b8839068",
"metadata": {},
"outputs": [],
"source": []
@@ -1076,7 +1302,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.12.3"
}
},
"nbformat": 4,