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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started