1
팬더 DF에 조건부 groupby
을 사용하고 싶습니다. 인지 'B'== 의해팬더 데이터 프레임을 조건부로 그룹화하려면 어떻게합니까?
test = pd.DataFrame({'A':range(9), 'B':['this','this','this','that','and','the','other','thing','.']})
그룹 'A'이 '(I 쿼리 구조 승 /이 상상 방법)
test['A'].groupby("B == 'this'").sum()
이 반환되어야 [3,33]
pd.Series([3,33])
감사합니다,
Gah. 물론 당신은 할 수. 감사. – PeterFoster