20251222
This commit is contained in:
1 parent
6803e6fff6
commit
b894e793a5
5 files changed
+1705
-202
No files matched your search
+166
-51
@@ -116,6 +116,59 @@
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"id": "de0185f6-a3ce-4d12-96d5-2d4fd01cf293",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-12-19T03:19:11.165261Z",
|
||||
"iopub.status.busy": "2025-12-19T03:19:11.164496Z",
|
||||
"iopub.status.idle": "2025-12-19T03:19:11.195061Z",
|
||||
"shell.execute_reply": "2025-12-19T03:19:11.194508Z",
|
||||
"shell.execute_reply.started": "2025-12-19T03:19:11.165190Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"85\n",
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/东营老年大学北体班2025年度复测花名册.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"person = {}\n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" if sheet.cell(n,1).value is not None:\n",
|
||||
" code = int(sheet.cell(n, 1).value)\n",
|
||||
" person.setdefault(code, {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 2).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 3).value\n",
|
||||
" dict1['unit'] = sheet.cell(n, 5).value\n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 4).value).replace('/','-').split(' ')[0]\n",
|
||||
" #dict1['age'] = sheet.cell(n, 6).value\n",
|
||||
" if sheet.cell(n,6).value is not None:\n",
|
||||
" dict1['phone'] = str(sheet.cell(n,6).value) \n",
|
||||
" person[code] = dict1\n",
|
||||
"filename = 'data/东营老年大学北体班2025年度复测.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
"print(len(person))\n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 88,
|
||||
@@ -473,6 +526,85 @@
|
||||
"print(len(re_ta))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"id": "b6faa6d3-8237-4e75-9014-a76826ae2c36",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-12-19T03:19:24.207176Z",
|
||||
"iopub.status.busy": "2025-12-19T03:19:24.206625Z",
|
||||
"iopub.status.idle": "2025-12-19T03:19:24.227876Z",
|
||||
"shell.execute_reply": "2025-12-19T03:19:24.226944Z",
|
||||
"shell.execute_reply.started": "2025-12-19T03:19:24.207123Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"59\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import datetime\n",
|
||||
"import csv\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"re_ta = {}\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/东营老年大学北体班2025年度复测.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/marks_20251219.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",
|
||||
"\n",
|
||||
"for result in list1:\n",
|
||||
" user = str(result[2])\n",
|
||||
" rq = date.fromisoformat(result[5].replace('/','-'))\n",
|
||||
" if user in dict1.keys():\n",
|
||||
" #print(user)\n",
|
||||
" l_xm = []\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]['unit'] = dict1[user]['unit']\n",
|
||||
" if 'phone' in dict1[user].keys():\n",
|
||||
" re_ta[user]['phone'] = dict1[user]['phone']\n",
|
||||
" if dict1[user]['sex'] == '男':\n",
|
||||
" l_xm = ['bmi','lung','grip','flexion','jump','pushup','balance','reaction','step']\n",
|
||||
" else:\n",
|
||||
" l_xm = ['bmi','lung','grip','flexion','jump','balance','reaction','step','situp']\n",
|
||||
" #re_ta[user]['unit'] = dict1[user]['unit']\n",
|
||||
" birth = date.fromisoformat(dict1[user]['birth'].replace('/','-'))\n",
|
||||
" item_name = result[3] \n",
|
||||
" if item_name in l_xm: \n",
|
||||
" days = (rq-birth).days \n",
|
||||
" re_ta[user]['age'] = int(days/365)\n",
|
||||
" re_ta[user]['month'] = int(days/365*12)\n",
|
||||
" re_ta[user]['rq'] = result[5]\n",
|
||||
" re_ta[user].setdefault(item_name,{}) \n",
|
||||
" score = result[4] \n",
|
||||
" re_ta[user][item_name]['成绩'] = score\n",
|
||||
"\n",
|
||||
"filename = 'data/result_东营老年大学北体班2025年度复测.json'\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": "74ec60b7-b1d9-488d-95fa-4ddd020c2a4c",
|
||||
@@ -483,15 +615,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"execution_count": 27,
|
||||
"id": "c3b99428-00d5-45ea-9803-261194525fa4",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-12-12T13:13:35.809342Z",
|
||||
"iopub.status.busy": "2025-12-12T13:13:35.808036Z",
|
||||
"iopub.status.idle": "2025-12-12T13:13:35.820106Z",
|
||||
"shell.execute_reply": "2025-12-12T13:13:35.818957Z",
|
||||
"shell.execute_reply.started": "2025-12-12T13:13:35.809273Z"
|
||||
"iopub.execute_input": "2025-12-19T03:19:29.967201Z",
|
||||
"iopub.status.busy": "2025-12-19T03:19:29.966497Z",
|
||||
"iopub.status.idle": "2025-12-19T03:19:29.983427Z",
|
||||
"shell.execute_reply": "2025-12-19T03:19:29.982437Z",
|
||||
"shell.execute_reply.started": "2025-12-19T03:19:29.967135Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -499,7 +631,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok!\n"
|
||||
"ok! 59\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -510,7 +642,7 @@
|
||||
"\n",
|
||||
"#list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','height','weight']\n",
|
||||
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
|
||||
"filename = 'data/result_油田老年大学年度体质复测.json'\n",
|
||||
"filename = 'data/result_东营老年大学北体班2025年度复测.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"for k, v in dict2.items():\n",
|
||||
@@ -533,10 +665,10 @@
|
||||
" dict2[k][item_en]['score'] = My.cal_score(data1)\n",
|
||||
" #print(k,v[item_en]['成绩'],cal_score(data1))\n",
|
||||
"\n",
|
||||
"filename = 'data/result_油田老年大学年度体质复测.json'\n",
|
||||
"filename = 'data/result_东营老年大学北体班2025年度复测.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict2,fl , ensure_ascii=False) \n",
|
||||
"print('ok!') "
|
||||
"print('ok!',len(dict2)) "
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1008,15 +1140,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 35,
|
||||
"execution_count": 28,
|
||||
"id": "0ba2e1a3-78c8-44d9-ab7d-b17b52b0a99f",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-12-12T13:38:13.857680Z",
|
||||
"iopub.status.busy": "2025-12-12T13:38:13.856977Z",
|
||||
"iopub.status.idle": "2025-12-12T13:38:13.880423Z",
|
||||
"shell.execute_reply": "2025-12-12T13:38:13.879532Z",
|
||||
"shell.execute_reply.started": "2025-12-12T13:38:13.857614Z"
|
||||
"iopub.execute_input": "2025-12-19T03:19:45.959079Z",
|
||||
"iopub.status.busy": "2025-12-19T03:19:45.958247Z",
|
||||
"iopub.status.idle": "2025-12-19T03:19:45.990040Z",
|
||||
"shell.execute_reply": "2025-12-19T03:19:45.989559Z",
|
||||
"shell.execute_reply.started": "2025-12-19T03:19:45.959012Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -1024,21 +1156,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"15684378667\n",
|
||||
"15684378667\n",
|
||||
"13699180673\n",
|
||||
"15105461296\n",
|
||||
"13012909096\n",
|
||||
"13954605763\n",
|
||||
"13287350839\n",
|
||||
"13561090015\n",
|
||||
"13287336162\n",
|
||||
"13963396946\n",
|
||||
"15105461298\n",
|
||||
"13864739068\n",
|
||||
"13013569039\n",
|
||||
"13864757610\n",
|
||||
"15725185717\n"
|
||||
"59\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -1051,13 +1169,13 @@
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"\n",
|
||||
"filename = 'data/result_油田老年大学年度体质复测.json'\n",
|
||||
"filename = 'data/result_东营老年大学北体班2025年度复测.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict3 = json.load(fl)\n",
|
||||
"\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"print(len(dict1))\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/sql_20251212.csv'\n",
|
||||
"filename = 'data/sql_20251219.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -1077,11 +1195,8 @@
|
||||
" for i in range(0,26):\n",
|
||||
" spine.append(0)\n",
|
||||
" phone = item[0][2:]\n",
|
||||
" print(phone)\n",
|
||||
" for k1, v1 in dict3.items():\n",
|
||||
" if 'phone' in v1.keys() and phone ==v1['phone']: \n",
|
||||
" dict1[k1] = dict3[k1]\n",
|
||||
" #dict1[k1]['month'] = dict1[k1]['age'] *12\n",
|
||||
" #print(phone)\n",
|
||||
" \n",
|
||||
"for item in list1:\n",
|
||||
" #print(item)\n",
|
||||
" psy = []\n",
|
||||
@@ -1136,7 +1251,7 @@
|
||||
" \n",
|
||||
" dict1[k1]['rq'] = item[2].replace('/','-').split(' ')[0]\n",
|
||||
"#print(dict1)\n",
|
||||
"filename = 'data/result_油田老年大学年度体质复测.json'\n",
|
||||
"filename = 'data/result_东营老年大学北体班2025年度复测.json'\n",
|
||||
"\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False) "
|
||||
@@ -1305,15 +1420,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"execution_count": 29,
|
||||
"id": "7ee80847-2bc0-4cbe-9534-c5dcf97c2833",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-12-12T13:38:35.200844Z",
|
||||
"iopub.status.busy": "2025-12-12T13:38:35.200220Z",
|
||||
"iopub.status.idle": "2025-12-12T13:38:42.941941Z",
|
||||
"shell.execute_reply": "2025-12-12T13:38:42.941270Z",
|
||||
"shell.execute_reply.started": "2025-12-12T13:38:35.200787Z"
|
||||
"iopub.execute_input": "2025-12-19T03:19:56.159337Z",
|
||||
"iopub.status.busy": "2025-12-19T03:19:56.157645Z",
|
||||
"iopub.status.idle": "2025-12-19T03:20:30.404540Z",
|
||||
"shell.execute_reply": "2025-12-19T03:20:30.403593Z",
|
||||
"shell.execute_reply.started": "2025-12-19T03:19:56.159261Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -1321,7 +1436,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"12\n"
|
||||
"59\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -1334,11 +1449,11 @@
|
||||
"headers = {\n",
|
||||
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
|
||||
" }\n",
|
||||
"filename = 'data/result_油田老年大学年度体质复测.json'\n",
|
||||
"filename = 'data/result_东营老年大学北体班2025年度复测.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"list1 = []\n",
|
||||
"file_path ='./油田老年大学年度体质复测/'\n",
|
||||
"file_path ='./油田老年大学北体班2025年度体质复测/'\n",
|
||||
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
|
||||
"i=0\n",
|
||||
"list2 = []\n",
|
||||
@@ -1348,7 +1463,7 @@
|
||||
" \n",
|
||||
" id = str(k).rjust(4,\"0\")\n",
|
||||
" mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n",
|
||||
" mydata['title'] = '油田老年大学年度体质复测'\n",
|
||||
" mydata['title'] = '油田老年大学北体班年度体质复测'\n",
|
||||
" mydata['subtitle'] = v['unit']\n",
|
||||
" mydata['id'] = id\n",
|
||||
" mydata['name'] = v['name']\n",
|
||||
|
||||
Reference in new issue
Block a user