"""
疫情通数据处理
@Author:小呼呼哈哈哈
"""
import pandas as pd
import numpy as np
file_name = "导出明细数据2021021914.csv"
Data_Source = pd.read_csv(file_name, encoding='gbk')
# print(Data_Source)
b = np.array(Data_Source)
col_Name = b[:, 0]
col_STUNum = b[:, 1]
col_Tel = b[:, 5]
col_Adderss_rough = b[:, 24]
col_Adderss_accurate = b[:, 25]
# 目标地区学生代号
def findindex(org, x, pos=-1):
counts = org.count(x) #先求出org中包含x的个数
list_1 = []
for i in range(counts):
pos = org.index(x, pos + 1)
list_1.append(pos)
return list_1
col_Adderss = col_Adderss_rough.tolist() # 将numpy数组转化为列表
org = col_Adderss
Target_location = '陕西省西安市碑林区' # 请输出目标地区
Target_location_dis = Target_location[:3]+' '+Target_location[3:6]+' '+Target_location[6:] # 自行修改参数
print('确定的搜索目标:\n',Target_location_dis)
Match_position = findindex(org, Target_location_dis) # 在目标地点的学生代码list
print(Match_position)
# 判断是否有学生在目标区域
if Target_location_dis in col_Adderss_rough:
print("有学生在目标地区附近")
else:
print("没有学生在目标地区附近")
Match_Name = []
Match_AdreS = []
for i in Match_position:
temp1 = col_Name[i]
Match_Name.append(temp1)
temp2 = col_Adderss_accurate[i]
Match_AdreS.append(temp2)
print('在', Target_location,'的学生名单及精确地点:\n', Match_Name, '\n', Match_AdreS)
"""
未完待续
"""
办公用脚本——疫情通打卡数据处理0218
最新推荐文章于 2024-07-27 12:20:46 发布