for i in range(0,9):
num = training_data[training_data[i]==row[i]&training_data[9]==1].groupby([i,9]).size()
print num
count_equals.append(num)
DataFrame
0 1 2 3 4 5 6 7 8 9
314 1 1 1 1 1 1 2 1 1 1
431 5 1 1 3 4 1 3 2 1 1
260 10 5 8 10 3 10 5 1 3 -1
91 3 1 1 2 2 1 1 1 1 1
337 1 1 1 1 2 1 3 1 1 1
I need counts into a list else groupby without second condition works. if row =[1,1,1,1,1,1,1,1] then the count_equals list should be [2,4,4,2,4,1,3,4]
Error:
Traceback (most recent call last):
File "naive.py", line 46, in
num = training_data[training_data[i]==row[i]&training_data[9]==1].groupby([i,9]).size()
File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 917, in nonzero .format(self.class.name))
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().