Question: bList1 = [] sList1 = [] sAv = [] sOut = [] for sList in bList: av = np.average(sList) std = np.std(sList) for sVal in
bList1 = [] sList1 = [] sAv = [] sOut = []
for sList in bList:
av = np.average(sList) std = np.std(sList)
for sVal in sList:
if abs(sVal-av) < 2*std: sList1.append(sVal)
else: sOut.append(sVal)
av1 = np.average(sList1) sAv.append(av1) bList1.append(sList1)
print(sAv)
So I have a main list, bList, with list items in it, sList
For each sList in bList,
-> find the mean and standard dev. for that sList
then -> for each item, sVal, in that sList, see if that item meets criteria
if yes -> add to new list, sList1
if no -> add to new list, sOut
-> then find the mean for the newly created sList1, and add that to new list, sAv
in total I should have 13 new means in sAv, instead I have 3300+ lines of data!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
