This commit is contained in:
512song@sina.com committed 2023-03-24 19:39:11 +08:00
1 parent d30e4b0ca7
commit 177370c8e1
2 files changed
+269 -9

No files matched your search

+129
View File
@@ -0,0 +1,129 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "f501bde1-90cb-40c4-9dd4-533c27f81be5",
"metadata": {},
"source": [
"## 调查报告线下数据管理"
]
},
{
"cell_type": "markdown",
"id": "d31fa9b7-26d8-4101-94d1-f41723428aa9",
"metadata": {},
"source": [
"## 成年问卷导入"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "dc20aabb-3942-49b9-8841-8e8a0823033a",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/羊庙问卷统计表(成年组).xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"dict1 = {}\n",
"dict3 = {}\n",
"no_xinli = [108,389,268,270]\n",
"sheet = wb.active\n",
"data1 =list(sheet.values)\n",
"list_bh = data1[0][1:]\n",
"del data1[0]\n",
"print(len(list_bh))\n",
"for i in range(1,len(list_bh)+1):\n",
" list2 = []\n",
" \n",
" for item in data1:\n",
" list2.append(item[i])\n",
" dict1[list_bh[i-1]] = list2\n",
"for k, v in dict1.items():\n",
" if 0 in v:\n",
" print(k)\n"
]
},
{
"cell_type": "markdown",
"id": "75dda87e-804e-42ba-b1a4-08c8a8b65050",
"metadata": {},
"source": [
"## 老年问卷导入"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "09a354e6-a07a-40b8-9b8c-3499fb0b7c28",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/羊庙问卷统计表(老年组).xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"dict1 = {}\n",
"dict3 = {}\n",
"no_xinli = [286]\n",
"sheet = wb.active\n",
"data1 =list(sheet.values)\n",
"list_bh = data1[0][1:]\n",
"print(list_bh)\n",
"del data1[0]\n",
"print(len(list_bh))\n",
"for i in range(1,len(list_bh)+1):\n",
" list2 = []\n",
" \n",
" for item in data1:\n",
" list2.append(item[i])\n",
" dict1[list_bh[i-1]] = list2\n",
"for k, v in dict1.items():\n",
" if 0 in v or ' ' in v:\n",
" print(k)\n",
"print(dict1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "10198e81-cea0-475a-bce7-4a4829320517",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}