xiongdong57's recent timeline updates
xiongdong57

xiongdong57

V2EX member #149526, joined on 2015-12-01 20:02:08 +08:00
xiongdong57's recent replies
def category(x):
# column contains N1,N2,N3,N4,sum
level = min(100 - x.loc['sum'], 30) // 10

x = x[["N1", "N2", "N3", "N4"]]
count = (x < 60).sum()
category = level + min(count, 2)

if category < 1:
return "A"
elif category < 2:
return "B"
elif category < 3:
return "C"
else:
return "D"

df['category'] = df.apply(category, axis=1)

规则好像不全,可以全部补充到分类函数里
Apr 25, 2016
Replied to a topic by xioce Python 新手, Python LXML 模块安装不了怎么办?
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2321 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 19ms · UTC 05:18 · PVG 13:18 · LAX 22:18 · JFK 01:18
♥ Do have faith in what you're doing.