import xlrd
import matplotlib
# matplotlib.use('Agg') #不顯示作圖過程import matplotlib.pyplot as plt
import os
讀EXCEL
defread_excel(path):#打開工作簿wb=xlrd.open_workbook(path)#查看工作表名字sheet_name=wb.sheet_names()[0]print(sheet_name)#獲取工作表# sheet=wb.sheet_by_index(0)sheet=wb.sheet_by_name(sheet_name)#獲取行數和列數nrows=sheet.nrowsncols=sheet.ncols#獲取每一行都存入列表rows_list=[]for i inrange(nrows):rows_list.append(sheet.row_values(i))return rows_list
分析數據
defgetData():excel_path='./醫院.xlsx'#急診科男女分別的人數,醫院就診的人數,每個診室就診人數,并在控制臺輸出,ls=read_excel(excel_path)# print(ls)xingbie_dir={}keshi_dir={}renshu_dir={}for i inrange(1,len(ls)):if ls[i][1]in xingbie_dir:xingbie_dir[ls[i][1]]+=1else:xingbie_dir[ls[i][1]]=1if ls[i][4]in renshu_dir:renshu_dir[ls[i][4]]+=1else:renshu_dir[ls[i][4]]=1if ls[i][3]in keshi_dir:keshi_dir[ls[i][3]]+=1else:keshi_dir[ls[i][3]]=1print(xingbie_dir,keshi_dir,renshu_dir)getData()
餅狀圖
#獲取數據print(xingbie_dir)
xingbie_nums=list(xingbie_dir.values())print(xingbie_nums)
xingbie_label=list(xingbie_dir.keys())print(xingbie_label)
plt.pie( xingbie_nums,labels=xingbie_label,autopct='%1.1f%%',counterclock=False,startangle=90)
plt.title("Male to femal ratio in the last five days of emergency department")
plt.savefig("./餅狀圖.jpg")
plt.show()
plt.close()
Yet Another Monster Fight
Problem - D - Codeforces
題目大意:
現在給你一堆怪物,你擁有法術(一個法術可以連續攻擊這n個所有怪物),你可以選擇任意一個怪物作為法術的第一個攻擊目標(傷害為xÿ…
行為識別相關的開發實踐在我們之前的博文中也有過相關的實踐了,感興趣的話可以自行移步閱讀即可:《python實現基于TNDADATASET的人體行為識別》
《UCI行為識別——Activity recognition with healthy older people using a batteryless wearable sensor Data Set》《人體行為…
1、先構建基本的netty框架
再下面的代碼中我構建了一個最基本的netty實現websocket的框架,其他個性化部分再自行添加。
Slf4j
public class TeacherServer {public void teacherStart(int port) throws InterruptedException {NioEventLoopGroup boss new NioEve…