我希望在分组后拥有所有密钥组合,以便for(int i = 0; i < counts.length; i++) {
char gradeAsChar = 'A' + i;
System.out.println(gradeAsChar + ":"+ counts[i]);
}
具有a
个唯一值且na
具有b
个唯一值而不是输出行数应该是nb
。我尝试了na*nb
和reindex
,但它无效:
reindex_axis
我想得到:
>>> df = pd.DataFrame({'a': [1,1,2,3],'b':[1, 2, 3,4], 'c':[1,2,3,4]})
>>> df.groupby(['a','b']).count()
c
a b
1 1 1
2 1
2 3 1
3 4 1
答案 0 :(得分:6)
您可以使用reindex:
x.cpp: In instantiation of ‘void p<type>::f() [with type = int]’:
x.cpp:26:9: required from here
x.cpp:19:13: error: invalid use of unary ‘*’ on pointer to member
cout << *q;
^