Files
jupyter/体质检测管理.ipynb
T
2021-10-09 15:12:24 +08:00

87 lines
2.5 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"id": "4925cb3a-bea3-4a4d-9590-6b91b62ca5b4",
"metadata": {},
"source": [
"# 体质检测管理"
]
},
{
"cell_type": "markdown",
"id": "2a85feec-695b-4ea8-8093-91a59ed34c7f",
"metadata": {},
"source": [
"## 体测单位信息导入"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "c5a0568c-3833-4335-a4b9-600310e1a541",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['综合办公室(党委办公室)', '销运管理部', '财务资产部', '财务管理部', '企业管理部(法律事务部)', '发展计划部', '生产技术部', '设备工程部', '安全环保部', '党委组织部(资源管理部)', '审计管理部', '党群文化部(党委宣传部、工会、团委)', '纪委(监督部)', '检验计量中心', '物资采购中心', '信息中心', '行政事务中心', '消防救援支队', '电气仪表中心', '炼油运行一部', '炼油运行二部', '炼油运行三部', '炼油运行四部', '炼油运行五部', '化工运行部', '热电运行部', '水务运行部', '储运运行部', '编组站']\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"import pymongo\n",
"\n",
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
"mydb = myclient[\"tice\"]\n",
"mycol = mydb[\"unit\"]\n",
"wb = openpyxl.load_workbook('./data/shijiazhuang.xlsx')\n",
"sheet = wb.active\n",
"#sheets = wb.sheetnames\n",
"depart = []\n",
"dict1 = {}\n",
"new_code = []\n",
"for n in range(2,sheet.max_row+1):\n",
" m_depart = sheet.cell(n,3).value\n",
" if m_depart not in depart:\n",
" depart.append(sheet.cell(n,3).value)\n",
" #print(sheet.cell(n,5).value)\n",
"print(depart)\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aab6612f-4aad-46f0-89cd-0384ae7ac0c9",
"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
}