-179.750 71.250 -20.1 -16.1 -19.0 -15.2 -5.1 -0.7 2.9 4.8 0.9
-3.5 -5.3 -19.0
-179.750 68.750 -23.3 -18.8 -22.7 -16.1 -6.0 -0.2 4.0 5.0 0.9 -5.3
-8.8 -22.2
-179.750 68.250 -23.8 -20.1 -24.1 -16.9 -7.0 -0.2 4.1 4.9 0.2 -6.6
-10.0 -22.7
-179.750 67.750 -22.6 -19.6 -23.6 -15.9 -5.8 2.3 7.1 7.3 1.5 -6.6
-9.9 -21.7
-179.750 67.250 -24.4 -22.6 -26.4 -18.2 -7.7 1.8 7.3 6.7 -0.5 -10.1
-13.3 -24.3
(txt file values provided above)
---------------------
Hello!! Could someone please help me that, skip using the first column
and each value per row in the second column if greater than 68.500, elif less than 68.250,
please takes the list of lists and an integer column index.
Returns a new list that contains the average values of the target column from all of the rows.
---------------------
if list[1] >= 68.500, the lists which would be used are this:
-179.750 71.250 -20.1 -16.1 -19.0 -15.2 -5.1
-0.7 2.9 4.8 0.9 -3.5 -5.3 -19.0
-179.750 68.750 -23.3 -18.8 -22.7 -16.1 -6.0 -0.2
4.0 5.0 0.9 -5.3 -8.8 -22.2
---------------------
if list[1] <=68.250, the lists which would be used are this:
-179.750 68.250 -23.8 -20.1 -24.1 -16.9 -7.0
-0.2 4.1 4.9 0.2 -6.6 -10.0 -22.7
-179.750 67.750 -22.6 -19.6 -23.6 -15.9 -5.8 2.3
7.1 7.3 1.5 -6.6 -9.9 -21.7
-179.750 67.250 -24.4 -22.6 -26.4 -18.2 -7.7 1.8
7.3 6.7 -0.5 -10.1 -13.3 -24.3
---------------------
both output: [average of column 2, avg of column 3, .... , avg of final column]
---------------------
Please do this in python,
Thank you!!!
l=[]
fh = open('values.txt')
while True:
line = fh.readline()
if line!='':
l.append(line.split())
if not line:
break
fh.close()
sum1=[]
sum2=[]
for i in l:
if float(i[1])>=68.500:
sum1.append(i[1::])
elif float(i[1])<=68.250:
sum2.append(i[1::])
sum1 = [[float(j) for j in i] for i in sum1]
sum2 = [[float(j) for j in i] for i in sum2]
avg1=[sum(x) for x in zip(*sum1)]
avg2=[sum(x) for x in zip(*sum2)]
avg1=list(map(lambda x : x/len(sum1),avg1))
avg2=list(map(lambda x : x/len(sum2),avg2))
print(avg1)
print(avg2)
It may not be very elegant, strictly sticking to pure python. It's a lot simpler with numpy but since you specified 'list of lists', I stuck to the basics.
Hope it helps let me know if you require further assistance.
-179.750 71.250 -20.1 -16.1 -19.0 -15.2 -5.1 -0.7 2.9 4.8 0.9 -3.5 -5.3 -19.0 -179.750 68.750...
can u clearly show me how to find a sample size (N) , A2, and
can you also tell me why we are using an X Chart?
Problem 1 A restaurant wants to control kitchen preparation time of dinner meals using an X chart. The process standard deviation is unknown. Each evening a manager takes a random sample of 14 dinner orders and measures and records their kitchen preparation time. Create an X Chart using data in the table below...
a) Insert here a copy of the plot for the heating curve you created in laboratory. Remember that an acceptable plot has labels and units on the axes, a legend, and a title. PLOT GRAPH Run 1 Time Temperature T T min °C 0.0 22.0 0.2 22.0 0.5 22.1 0.8 21.9 1.0 22.2 1.2 22.1 1.5 22.1 1.8 22.3 2.0 22.0 2.2 21.9 2.5 22.0 2.8 22.2 3.0 22.7 3.2 23.6 3.5 24.7 3.8 26.5 4.0 28.0 4.2 29.6 4.5 ...
We are interested in the relationship between the compensation of Chief Executive Officers (CEO) of firms and the return on equity of their respective firm, using the dataset below. The variable salary shows the annual salary of a CEO in thousands of dollars, so that y = 150 indicates a salary of $150,000. Similarly, the variable ROE represents the average return on equity (ROE)for the CEO’s firm for the previous three years. A ROE of 20 indicates an average return...