20240924
This commit is contained in:
1 parent
96f043313c
commit
3a9cb48f1e
5 files changed
+1697
-229
No files matched your search
+98
-141
@@ -10,18 +10,33 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "a03a5289-9766-4a60-9d38-245deb2ee4e6",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-23T08:54:21.300838Z",
|
||||
"iopub.status.busy": "2024-09-23T08:54:21.300070Z",
|
||||
"iopub.status.idle": "2024-09-23T08:54:21.477586Z",
|
||||
"shell.execute_reply": "2024-09-23T08:54:21.476575Z",
|
||||
"shell.execute_reply.started": "2024-09-23T08:54:21.300765Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/天宫院街道2024.xlsx')\n",
|
||||
"wb = openpyxl.load_workbook('data/240922名单.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"person = {}\n",
|
||||
@@ -36,14 +51,13 @@
|
||||
" \n",
|
||||
" dict1['sex'] = sheet.cell(n,3).value\n",
|
||||
" birth = str(sheet.cell(n, 4).value).split()[0]\n",
|
||||
" dict1['birth'] = birth.replace('/','-')\n",
|
||||
" dict1['birth'] = birth.replace('/','-') \n",
|
||||
" \n",
|
||||
" person[code] = dict1\n",
|
||||
" if sheet.cell(n,5).value is not None:\n",
|
||||
" dict1['phone'] = sheet.cell(n,5).value\n",
|
||||
"\n",
|
||||
" person[code] = dict1\n",
|
||||
"filename = 'data/天宫院街道2024.json'\n",
|
||||
"filename = 'data/天宫院社区240922.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
"print('ok')"
|
||||
@@ -51,26 +65,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": null,
|
||||
"id": "b29a6f3c-035c-4c74-bbac-61e83be2b37c",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-07-11T08:18:28.633340Z",
|
||||
"iopub.status.busy": "2024-07-11T08:18:28.632568Z",
|
||||
"iopub.status.idle": "2024-07-11T08:18:28.654035Z",
|
||||
"shell.execute_reply": "2024-07-11T08:18:28.653382Z",
|
||||
"shell.execute_reply.started": "2024-07-11T08:18:28.633268Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -149,12 +147,28 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"id": "db39190f-47d4-4a7c-b727-c79e2a64452f",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-23T08:55:23.555758Z",
|
||||
"iopub.status.busy": "2024-09-23T08:55:23.554865Z",
|
||||
"iopub.status.idle": "2024-09-23T08:55:23.569912Z",
|
||||
"shell.execute_reply": "2024-09-23T08:55:23.568888Z",
|
||||
"shell.execute_reply.started": "2024-09-23T08:55:23.555680Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"31\n",
|
||||
"31\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
@@ -170,11 +184,11 @@
|
||||
"re_ta = {}\n",
|
||||
"dict1 = {}\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/天宫院街道2024.json'\n",
|
||||
"filename = 'data/天宫院社区240922.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/places_result_20240710.csv'\n",
|
||||
"filename = 'data/places_result_20240923.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -194,7 +208,7 @@
|
||||
" 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_天宫院街道2024.json'\n",
|
||||
"filename = 'data/result_天宫院社区240922.json'\n",
|
||||
"\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(re_ta, fl, ensure_ascii=False) \n",
|
||||
@@ -203,15 +217,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 3,
|
||||
"id": "590775c3-16ef-43ad-99a2-85e847fe4079",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-07-11T08:19:29.653063Z",
|
||||
"iopub.status.busy": "2024-07-11T08:19:29.652598Z",
|
||||
"iopub.status.idle": "2024-07-11T08:19:29.662479Z",
|
||||
"shell.execute_reply": "2024-07-11T08:19:29.661939Z",
|
||||
"shell.execute_reply.started": "2024-07-11T08:19:29.653037Z"
|
||||
"iopub.execute_input": "2024-09-23T08:57:30.916080Z",
|
||||
"iopub.status.busy": "2024-09-23T08:57:30.915319Z",
|
||||
"iopub.status.idle": "2024-09-23T08:57:30.930835Z",
|
||||
"shell.execute_reply": "2024-09-23T08:57:30.929793Z",
|
||||
"shell.execute_reply.started": "2024-09-23T08:57:30.916010Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -219,8 +233,8 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"61\n",
|
||||
"61\n"
|
||||
"31\n",
|
||||
"31\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -239,11 +253,11 @@
|
||||
"re_ta = {}\n",
|
||||
"dict1 = {}\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/天宫院街道all.json'\n",
|
||||
"filename = 'data/天宫院社区240922.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/places_result_20240710.csv'\n",
|
||||
"filename = 'data/places_result_20240923.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -262,7 +276,7 @@
|
||||
" 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_天宫院街道all.json'\n",
|
||||
"filename = 'data/result_天宫院社区240922.json'\n",
|
||||
"\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(re_ta, fl, ensure_ascii=False) \n",
|
||||
@@ -279,15 +293,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 4,
|
||||
"id": "c2ee2c71-7e28-4201-af85-ed7f001c6872",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-07-11T08:19:59.192307Z",
|
||||
"iopub.status.busy": "2024-07-11T08:19:59.191555Z",
|
||||
"iopub.status.idle": "2024-07-11T08:19:59.221577Z",
|
||||
"shell.execute_reply": "2024-07-11T08:19:59.220830Z",
|
||||
"shell.execute_reply.started": "2024-07-11T08:19:59.192234Z"
|
||||
"iopub.execute_input": "2024-09-23T08:58:27.504156Z",
|
||||
"iopub.status.busy": "2024-09-23T08:58:27.503390Z",
|
||||
"iopub.status.idle": "2024-09-23T08:58:27.530165Z",
|
||||
"shell.execute_reply": "2024-09-23T08:58:27.529383Z",
|
||||
"shell.execute_reply.started": "2024-09-23T08:58:27.504064Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -296,18 +310,37 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"101 李先生\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "KeyError",
|
||||
"evalue": "'sex'",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[0;32mIn[10], line 20\u001b[0m\n\u001b[1;32m 18\u001b[0m list2\u001b[38;5;241m.\u001b[39mappend(\u001b[38;5;28mstr\u001b[39m(k)\u001b[38;5;241m.\u001b[39mrjust(\u001b[38;5;241m3\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m0\u001b[39m\u001b[38;5;124m'\u001b[39m))\n\u001b[1;32m 19\u001b[0m list2\u001b[38;5;241m.\u001b[39mappend(v[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m'\u001b[39m]) \n\u001b[0;32m---> 20\u001b[0m list2\u001b[38;5;241m.\u001b[39mappend(\u001b[43mdict2\u001b[49m\u001b[43m[\u001b[49m\u001b[43mk\u001b[49m\u001b[43m]\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43msex\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m)\n\u001b[1;32m 23\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m item \u001b[38;5;129;01min\u001b[39;00m items:\n\u001b[1;32m 24\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m item \u001b[38;5;129;01min\u001b[39;00m v\u001b[38;5;241m.\u001b[39mkeys():\n",
|
||||
"\u001b[0;31mKeyError\u001b[0m: 'sex'"
|
||||
"31 魏丽\n",
|
||||
"1 李雪莉\n",
|
||||
"2 张进刚\n",
|
||||
"3 杨宾\n",
|
||||
"4 武馨怡\n",
|
||||
"6 高天蕴\n",
|
||||
"5 王红柳\n",
|
||||
"7 刘颖\n",
|
||||
"8 段丽阳\n",
|
||||
"9 段宇辰\n",
|
||||
"10 范文兰\n",
|
||||
"11 张耀聪\n",
|
||||
"12 杨玉芬\n",
|
||||
"13 王柱明\n",
|
||||
"14 舒浩轩\n",
|
||||
"15 罗靖卓\n",
|
||||
"16 张玉后\n",
|
||||
"17 朱芷祁\n",
|
||||
"18 卢浥尘\n",
|
||||
"19 张傲楠\n",
|
||||
"20 尹晓晴\n",
|
||||
"21 董润华\n",
|
||||
"22 刘小云\n",
|
||||
"23 程军妮\n",
|
||||
"24 茅晴晴\n",
|
||||
"25 李嘉睿\n",
|
||||
"26 郑慧敏\n",
|
||||
"27 郑文结\n",
|
||||
"28 潘妍\n",
|
||||
"29 林景平\n",
|
||||
"30 宋元宵\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -317,11 +350,11 @@
|
||||
"\n",
|
||||
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"title = ['编号','姓名','性别','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"filename = 'data/result_天宫院街道.json'\n",
|
||||
"filename = 'data/result_天宫院社区240922.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/天宫院街道all.json'\n",
|
||||
"filename = 'data/天宫院社区240922.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
" \n",
|
||||
@@ -342,7 +375,7 @@
|
||||
" else:\n",
|
||||
" list2.append('') \n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/天宫院社区体测情况表_all.xlsx'\n",
|
||||
"filename = 'data/天宫院社区体测情况表_240922.xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
@@ -354,86 +387,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": null,
|
||||
"id": "ddba1233-6ab2-480d-8bde-ed8e1c34e48e",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-07-11T08:20:48.587834Z",
|
||||
"iopub.status.busy": "2024-07-11T08:20:48.587065Z",
|
||||
"iopub.status.idle": "2024-07-11T08:20:48.615936Z",
|
||||
"shell.execute_reply": "2024-07-11T08:20:48.615410Z",
|
||||
"shell.execute_reply.started": "2024-07-11T08:20:48.587764Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"101 李有才\n",
|
||||
"44 星众豪\n",
|
||||
"94 谢红印\n",
|
||||
"14 孙一萂\n",
|
||||
"132 梁正文\n",
|
||||
"123 刘\n",
|
||||
"93 李洪芝\n",
|
||||
"71 李羽馨\n",
|
||||
"91 孙婧祎\n",
|
||||
"8 王红晶\n",
|
||||
"126 马\n",
|
||||
"125 陈\n",
|
||||
"6 刘艳\n",
|
||||
"96 薛颖\n",
|
||||
"2 刘书本\n",
|
||||
"40 杨春华\n",
|
||||
"9 霍思诺\n",
|
||||
"124 苗\n",
|
||||
"128 张\n",
|
||||
"78 朱蕊\n",
|
||||
"10 李晨曦\n",
|
||||
"5 李芳\n",
|
||||
"100 聂彦芹\n",
|
||||
"4 富红\n",
|
||||
"68 冯瑞文\n",
|
||||
"108 杨\n",
|
||||
"130 徐\n",
|
||||
"86 阎树芹\n",
|
||||
"83 张万成\n",
|
||||
"116 白景香\n",
|
||||
"103 王梓涵\n",
|
||||
"15 王慧兰\n",
|
||||
"36 冯玉红\n",
|
||||
"118 王玉芬\n",
|
||||
"102 王岩东\n",
|
||||
"19 张竹辰\n",
|
||||
"38 路德慧\n",
|
||||
"111 张\n",
|
||||
"37 张影\n",
|
||||
"25 孟现春\n",
|
||||
"41 朱朝云\n",
|
||||
"85 武宜国\n",
|
||||
"107 刘连英\n",
|
||||
"20 王韵琪\n",
|
||||
"7 李雪\n",
|
||||
"18 王真秀\n",
|
||||
"98 张建霞\n",
|
||||
"131 陈艳莉\n",
|
||||
"106 沈建新\n",
|
||||
"43 杨桂兰\n",
|
||||
"127 张\n",
|
||||
"39 韩润壮\n",
|
||||
"129 薛\n",
|
||||
"110 赵\n",
|
||||
"79 郭忠臣\n",
|
||||
"81 赵淑芬\n",
|
||||
"115 朱\n",
|
||||
"114 王淑云\n",
|
||||
"62 赵秀香\n",
|
||||
"31 张成林\n",
|
||||
"99 张东喜\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
|
||||
Reference in new issue
Block a user