计算范围内的值

时间:2019-04-30 21:06:31

标签: python pandas

我正在尝试使薪水在一定范围内的员工人数。如何只为“工资”列输出数字。

salaryEmp = data4[data4.Salary.between(100, 500)].count()

3 个答案:

答案 0 :(得分:2)

您可以尝试value_counts

data4.Salary.value_counts(bins=[100,500])

答案 1 :(得分:1)

使用

df.loc[df.Salary.between(100,500), 'Salary'].count()

答案 2 :(得分:0)

我会做类似的事情:

L = [... your list .... ] key = "link_click" result = next( (d["value"] for d in L if d["action_type"]==key), 0)

相关问题