In the past I used to make calculation of conditional statements through pandas dataframe which returns Y/N to 1/0 and then calculate and get score. However I want to learn advanced method to implement calculation with larger dataset within a list.
Here is my code :
a=[234,45,57]
b=[26,51,59]
c=[87,23,56]
avrg_score = [['A',a[0]>0],
['B',b[0]>0],
['C',b[0]>0],
['C',a[0]*b[0]>c[0]],]
avrg_score = pd.DataFrame(avrg_score, columns=['Figure','Pass'],dtype=float).round(3)
x=avrg_score.Figure.count()
y=avrg_score.Pass.sum()
avrg_score_result=(x/y)*100
output:
100
But this is for index [0]
for 3 lists (a,b,c) , however I need manually do for the rest of the indexes of the lists.
How can I do automatically for all indexes for the given lists?
when I put such format for the full list:
avrg_score = [['A',a>0],
['B',b>0],
['C',b>0],
['C',a*b>c]]
I get such error:
'>' not supported between instances of 'list' and 'int'
Would appreciate any help.