This commit is contained in:
512song committed 2024-05-06 12:48:29 +08:00
1 parent fc007608ca
commit fcaecfd995
2 files changed
+169 -45

No files matched your search

+14 -44
View File
@@ -120,15 +120,15 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 1,
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
"metadata": {
"execution": {
"iopub.execute_input": "2023-11-26T12:31:39.094899Z",
"iopub.status.busy": "2023-11-26T12:31:39.094370Z",
"iopub.status.idle": "2023-11-26T12:31:39.114981Z",
"shell.execute_reply": "2023-11-26T12:31:39.114071Z",
"shell.execute_reply.started": "2023-11-26T12:31:39.094860Z"
"iopub.execute_input": "2024-05-06T04:04:00.891103Z",
"iopub.status.busy": "2024-05-06T04:04:00.890635Z",
"iopub.status.idle": "2024-05-06T04:04:00.919838Z",
"shell.execute_reply": "2024-05-06T04:04:00.918845Z",
"shell.execute_reply.started": "2024-05-06T04:04:00.891065Z"
},
"tags": []
},
@@ -137,8 +137,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"16\n",
"16\n"
"41\n",
"41\n"
]
}
],
@@ -157,11 +157,11 @@
"re_ta = {}\n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/北京党校.json'\n",
"filename = 'data/青海.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20231126.csv'\n",
"filename = 'data/places_result_20240311.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -182,7 +182,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_北京党校20231126.json'\n",
"filename = 'data/result_青海20240311.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
@@ -212,11 +212,11 @@
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"\n",
"filename = 'data/result_北京党校.json'\n",
"filename = 'data/result_青海20240311.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/北京党校.json'\n",
"filename = 'data/青海.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
" \n",
@@ -235,7 +235,7 @@
" else:\n",
" list2.append('') \n",
" list1.append(list2)\n",
"filename = 'data/北京党校.xlsx'\n",
"filename = 'data/青海20240311.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
@@ -253,36 +253,6 @@
"## 手工数据导入数据库"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "def3f47a-24ef-4815-b63b-2a16b79b4c15",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"filename = 'data/北京党校.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
"wb = openpyxl.load_workbook('data/北京党校手工数据.xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"dict1 = {}\n",
"dict3 = {1:10,2:11,3:7,4:2,5:6,6:3,7:1}\n",
"sheet = wb.active\n",
"data1 =list(sheet.values)\n",
"del data1[0]\n",
"list1 = []\n",
"for item in data1:\n",
" code = int(item[0])\n",
" list1.append((496534,code,item[2],item[1],'2023-10-15','2023-10-15 14:00:00'))\n",
"print(list1)"
]
},
{
"cell_type": "code",
"execution_count": null,