I have a list lt[][]
which contains float values.Now when I try to find the average or mean of these float values I get an error as either float object has no attribute mean
or float object is not iterable
. The code that I am using is:
for i in range(100):
acc_pos = marks[i][5] # list of float values
pos_acc.append((sum(acc_pos))/(len(acc_pos))) # when used then 2nd error comes
neg_acc.append(acc_pos.mean()) # when used then 1st error comes
NOTE: I am not using both the method together but either of them.The error comes according to the line I used
UPDATE: marks is a list of list-something like [78.3,[1,0,,1...],...]
. So by writing marks[i][5]
, I am trying to access 0 index element for each row.