FAQ Database Discussion Community

## SQL select sum/average all rows

sql-server,select,sum,average
i have this code who picks rows from table, but i need to make him return sum of all rows or avg of all rows. I tried to put code in other select like select within sum(select), but its not working, any ideas how to make it work? Sorry for...

## Percentage by group - oracle

sql,oracle,group-by,average
I have this sample. What I need is getting an average per key not key and value. However, the syntax I used appear to give me the average per key and value. select avg(value2),KEY,VALUE from testavg GROUP BY key,value order by key, value Doing otherwise will yield a syntax error....

## Get average value from list of dictionary

python,list,dictionary,average
I have lists of dictionary. Let's say it total = [{"date": "2014-03-01", "value": 200}, {"date": "2014-03-02", "value": 100}{"date": "2014-03-03", "value": 400}] I need get maximum, minimum, average value from it. I can get max and min values with below code: print min(d['value'] for d in total) print max(d['value'] for d...

## T-SQL Count all rows and group by id

sql,sql-server,group,average
i have a little problem with sql. I need help by a query where is can count all rows and group by the id. I need this, because i need to get the average of logins. Table have this: MRr, date MNr 3 => 5 entries MNr 4 => 2...

## Computing averages for a group of neighboring points in a line

python,average
I am trying to compute the average for a group of neighboring points in an array that I can easily move around. I've been advised to define a vector called a "dither" of integers from for example, 5 to 15. Heres the code I have right now: import matplotlib.pyplot as...

## SQL Case average formula output issue

sql,sql-server,case,average
Everyone - I could use your help. I have a SQL where I am checking a column to see if there is an amount. If there isn't I want it to output NULL. If it does I want it to calculate an average. I'm using this case statement and the...

## Trying to calculate the average of inputs given using do-while and while loop but it keeps stopping

java,while-loop,average,do-while
The main gist of the script is to keep asking for grades until the user inputs a negative number. Once a negative number has been input, it calculates the average of those grades. The grade that was input by the user can only be 4-10. I've been for hours now...

## How to average elements in several data frames with unequal size?

r,average,dataframes,reduce
I have a series of text files (100 files) with same structure (same number of columns) that need to be averaged for each element in all files. What I use is this code: my.list<-list() for(j in 1:100){ my.list[[j]]<-read.table(paste('file_',j,'.txt',sep='') ,header=TRUE) } all=Reduce("+", my.list) / length(my.list) This works quit fine when all...

## select records where value < avg() - incorrect results

sql,sql-server,average
I'm doing some basic exercises on NORTHWND db. I wanted to execute the following code: SELECT sum(SaleAmount) AS SaleAmount , CompanyName FROM [Sales Totals by Amount] where [SaleAmount] > ( Select avg(SaleAmount) as SaleAmount from [Sales Totals by Amount] ) group by CompanyName The average is equal to 4409,4948. When...

## Average Function in Pycharm

python,python-2.7,python-3.x,install,average
I'm just starting to learn Python from a book. But I keep running into the same problem when I run my script, it says: File "C:/Users/bob/Desktop/Python/Part3 A.py", line 8, in <module> print(' the average is: ', avg()) File "C:/Users/Bob/Desktop/Python/Part3 A.py", line 6, in avg average = a + b +...

## How to find average of Excel column A if B(i) is TRUE and B(i-1) is FALSE?

excel,average,conditional-statements
I know the title is confusing but it was no easy task to summarize the problem in one sentence so bear with me. I have two columns in Excel, column A contains real numbers, column B contains Boolean values of either TRUE or FALSE. I want to get the average...

## Making a method for an array

java,arrays,list,netbeans,average
I have an array that takes student grades from an input. I have to make a method that will find the average of the numbers within the array. Here is the code i have so far... int mark = Integer.parseInt(input.getText()); if(mark <= 100){ marks.add(Integer.parseInt(input.getText())); input.setText(""); warningLbl.setText(""); } else{ warningLbl.setText("Please enter...

## Average in assembly 8086 (macro error)

assembly,macros,average,8086
The code below computes the average of 20 user entered numbers. It works fine when I disable ShowMsg msg2 (make it a comment), but when its enabled, I get this error : INT 21h, AH=09h - address: 0711E byte 24h not found after 2000 bytes. ; correct example of INT...

## Calculating EMA from an array of closing prices (nodejs)?

arrays,node.js,average,stocks,moving-average
I have an array of daily closing prices for a stock (historical data) formatted as such: var close = [39, 40.133, 38.23, .... , 45.38] these are in order chronologically by date. I am trying to make an array of EMA (exponential moving average) values of the closing price to...

## Counting average number of repeated variables

count,sas,average,frequency
I have a dataset of unique patient IDs (~250,000) that includes repeats. I want to count the average number of times each unique RID appears. I can only figure out how to count the actual number of times each unique RID appears using: proc freq data=patients; tables rid; run; IE:...

## Finding average of an array

c,arrays,algorithm,average
I am really struggling with finding weighted sum from an array. I have an array (1D size 28) called frequency and same sized same indexed array called peak. Arrays will always have either a value or zero. What I want to achieve is go through the array, retrieve both values...

## Get the average of the selected cells line by line in a file?

bash,shell,average
I have a single file with the multiple columns. I want to select few and get average for selected cell in a line and output the entire average as column. For example: Month Low.temp Max.temp Pressure Wind Rain JAN 17 36 120 5 0 FEB 10 34 110 15 3...

## New Column with average by Date in SQL Server

sql,sql-server,average
I have this table: OrganizationCode | CreatedDate | TotalCost 102 | 2015-05-18 00:00:00.000 | 200 102 | 2015-05-18 00:00:00.000 | 550 102 | 2015-05-15 00:00:00.000 | 700 102 | 2015-05-15 00:00:00.000 | 1200 103 | 2015-01-27 00:01:12.720 | 1275,46 103 | 2015-01-27 00:01:12.720 | 1275,46 103 | 2015-01-27 00:01:12.720 |...

## Average Values from Specific Dates

excel,date,average
I have a column of dates in the form 2011-05-18 (yyyy-mm-dd), and have a column of strictly digits. I have tried using the averageif function: =AVERAGEIF(A:A,YEAR=2012,N:N) but this always returns #DIV/0! , even if that year does exist in the dataset. I want to be able to compile a list...

## R- min and max on a row, defined to a number of columns

r,max,average,minimum
I have 4 variables, each in triplicates, and I need to find the average for each triplicate, in each row, and on top of that find minimum and maximum for each 5th row, in order to plot error bars. Here is an example with two variables: x a1 a2 a3...

## XSLT - Selecting Min, Max, and Avg Attribute Values - Need Data from different Levels

xml,xslt,max,average,min
I thing my problem is that the attribute is on a couple of nodes down from the node that I need to select. Also, I need to pull values from different levels. Not sure how to construct the XPath. <?xml version="1.0"?> <software_inventory> <software xmlns:xsi="Software.xsd"> <title>Adobe Photoshop</title> <vendor>Adobe</vendor> <category>Graphics</category> <support_platforms> <platform>Windows...

## Sorting averages by highest to lowest in Python from text files

python,sorting,average
I am trying to sort averages of scores in a class by pupil, from highest to lowest. Here is my code so far: with open("class.txt") as f: d = {} for line in f: column = line.split(":") names = column scores = int(column.strip()) count = 0 while count < 3:...

## R - Averaging rows that have the same name

r,average
Very new to R. I have a simple data set with two columns : name and length. The data I have shows some names that have two occurrences. How do I average these lengths and then only list 1 name with the averaged length instead of the 2? Thank you....

## Get average of buckets of a date_histogram, elasticsearch

javascript,elasticsearch,average,datahistory
I have the following query where get the a data and I create an aggregation of each past hour: query = { "query": { "bool": { "must": [ { "term": {"deviceId":device} }, { "match": {"eventType":"Connected"} } ], "must_not":[{ "query_string": { "query": "Pong", "fields": ["data.message"] } }, ] }, }, "size":...

## mean day with hourly data from a week matlab

matlab,data,average,mean,days
I have a matrix with 24*7 rows(hourly data from the column week) and 52 columns(weeks in a year). I want to calculate the average day(with 24h) from each week (resulting with a 24-by-52 matrix). Normaly I would reshape the vector from each week so that I could have 24 rows...

## Java how to compute average scores using loops

java,loops,average,mean
I need to write a program in Java that computes the average score for 4 students. The student will put in their 4 scores, and once they are done they will input -1 to compute the average. Once this is done the program needs to move onto student 2 and...

## How to find an average of a key with multiple values?

python,max,average
I'm trying to print out the averages in order of highest to lowest however the code I have so far does the average for each person however then I'm unable to print them out in order of highest to lowest. I tried using the max function however it doesn't work....

## Display an updated average of random numbers in a file

c++,file-io,average
I have a program that displays one random number in file . #include <iostream> #include <fstream> #include <random> using namespace std; int main() { std::ofstream file("file.txt",std::ios_base::app); int var = rand() % 100 + 1; file<<var ; return 0; } Results after 4 trial : 1,2 2,20 3,40 1,88 I am...

## Applescript Error “can't get end of”

osx,applescript,apple,average
I am trying my hand at Applescript and can't see anything wrong with this. The Error I get is error "Can’t get end of {button returned:\"OK\", text returned:\"3\"}." number -1728 from last insertion point of {button returned:"OK", text returned:"3"} This is my code: beep set counter to 0 set tempX...

## VB.NET get average from a range of values from a sortedlist (sortedlist.average)

vb.net,average,sortedlist
I have a sortedlist like this; public MeasuredValues as SortedList(Of DateTime, Double) I throw in a bunch of values. For example; MeasuredValues.add(New DateTime(2010, 1, 1),33) MeasuredValues.add(New DateTime(2011, 1, 1),13) MeasuredValues.add(New DateTime(2012, 1, 1),233) MeasuredValues.add(New DateTime(2013, 1, 1),331) MeasuredValues.add(New DateTime(2014, 1, 1),732) MeasuredValues.add(New DateTime(2015, 1, 1),123) Now I want to get...

## Average of imported list (python)

python,list,numpy,sum,average
I'm trying to get the average of a list that has the following format: [["195", "106", "100", "95"]]. Now sum(list1) does not work (used for sum(list1)/len(list1)(while len(list1) works fine): TypeError: unsupported operand type(s) for +: 'int' and 'list' If the list were like this [195,106,100,95] it would work. The same...

## D3.js “Error: Invalid value for attribute” for moving average

javascript,d3.js,average
I am trying to create a moving average over the rest of the chart. I am trying to do something similar to this. However, for my data points I continuously get the error: "Error: Invalid value for attribute d="M1.2121212121212122,NaNL1.4141414141414141,NaNC1.6161616161616161,NaN,2.0202020202020203,NaN,2.4242424..." I believe it is because my data isn't formatted correctly, but...

## Java program calculates averages. How do I display highest average?

java,loops,average,mean
I have a java program that takes the scores of 4 players and computes each player's average score when -1 is inputted. At the end of the program I need to display the highest average score out of the 4 averages, however I cannot figure out how to do this,...

## How to calculate weighted average of non-zero values?

algorithm,go,average
I am new to Go, I am doing the following: I have a slice: valueList := []int16{500, 400, 0, 300} and a weight slice: weightList := []float64{0.1, 0.2, 0.3, 0.4} Now I want to do this: res := make([]float64, 4) for i, value := range valueList { res[i] = float64(value)...

## Finding the Average of all Odd and Even Numbers from an Input/Text File

java,average
Like the title states I have been looking to create a program that will loop over a text/input file (of numbers), then go on to find the Average for both odd and even numbers present in that file. I have currently managed to create what is shown below which has...

## Find Avg of Top 30 Results

sql-server,average
I have a query to output top 30 results select top 30 * from [dbo].[Stats] where Rack_Code = 'ABC' order by Date_of_Record desc and query to get averages for all time SELECT AVG(Total_MB - (East_MB + West_MB)) AS Other, AVG(East_MB) AS East, AVG(West_MB) AS West FROM [dbo].[Stats] WHERE Rack_Code =...

## Python 3.4 - How to get the average of dictionary values? [closed]

python,python-3.x,dictionary,average
I have the following dictionary: StudentGrades = { 'Ivan': [4.32, 3, 2], 'Martin': [3.45, 5, 6], 'Stoyan': [2, 5.67, 4], 'Vladimir': [5.63, 4.67, 6] } I want to make a function that prints the average of the grades of the students, i.e. the average of the values, but I have...

## Average of top 3 values within a specific pivot field

excel,vba,excel-vba,excel-formula,average
I have a table in which in one column I have values that are assigned to special models of hardware. The table looks like this: We need to find an average of three of the highest numbers for each model in that table, for example: We have a model 22PFx4109,...

## Excel Average if with multiple criteria

excel,if-statement,average
I am expanding on some help I got here yesterday. I am using the 'average' and 'if' functions as below: =AVERAGE(IF(YEAR(A:A)=1999,N:N)) I am wanting to also add the condition that if in column F the letters RD appear, the average will be calculated for that year. Then, I want to...

## AVG of AVG, aggregate functions of subquery

postgresql,aggregate,average,derived
This subquery produces the correct table. But now I want to get the average of the averages, and I'm getting an error "Missing FROM-clause entry for table "c"". SELECT c.name, AVG(avgvalue) FROM ( SELECT c.name, p.name, AVG(a."value") AS avgvalue FROM answers a INNER JOIN survey_responses sr ON sr.id = a.survey_response_id...

## Mean all other other columns based on a single column in r

r,data.frame,unique,average
I have a large dataframe that has more than 40,000 columns and I am running into a problem similar to this Sum by distinct column value in R shop <- data.frame( 'shop_id' = c('Shop A', 'Shop A', 'Shop A', 'Shop B', 'Shop C', 'Shop C'), 'Assets' = c(2, 15, 7,...

## Finding a mean value of velocity by month (using R)

r,date,average,subsetting
I have data table here: row V1 velocity 1 2009-04-06 95.9230769230769 2 2009-04-11 95.0985074626866 3 2009-04-17 95.8064935064935 4 2009-04-22 94.6357142857143 5 2009-04-27 95.3626865671642 6 2009-05-03 95.9101265822785 7 2009-05-08 95.826582278481 8 2009-05-14 94.5126582278481 9 2009-05-20 95.8371428571429 10 2009-05-25 94.6981481481481 11 2009-05-30 96.397619047619 12 2009-06-05 94.8132530120482 13 2009-06-10 96.4558139534884 14 2009-06-16 94.9627906976744...

## Average function not working corre

c++,average
I am working on a program for my C++ class, which the objective is to create a function to find the highest, lowest, mean and median of a vector and return it as a struct. I have every function working so far but the issue I am running into is...

## Looping through a method and using the results

java,loops,methods,average,standard-deviation
I am trying to loop through this method 10 times that searches an array of numbers captures the run time in nano seconds and prints the results. I then want t take the 10 run times and find the average and standard deviation. Is there a way to capture the...

## Averaging indexes of peaks if they are close in Python

python,arrays,sorting,replace,average
This might be a simple problem but I haven't come up with a solution. Say I have an array as np.array([0,1,0,1,0,0,0,1,0,1,0,0,1]) with peaks at indexes [1,3,7,9,12]. How can I replace the indexes with [2,8,12], that is, averaging indexes close in distance, if a threshold distance between peaks is set to...

## SQL Datetime Avg

sql,date,average
I am trying to get the avg total days between two dates using SQL. My Table is as follows intSalesPerson dtmDateSetup dtmWelcomeLetterSent 1 2015-02-18 22:47:13.890 2015-03-19 19:53:04.153 1 2015-03-06 13:04:20.730 2015-03-19 19:55:29.800 1 2015-03-16 18:16:43.290 2015-03-19 19:55:25.690 My SQL query is something like this? select avg([dtmDateSetup] - [dtmWelcomeLetterSent]) as avg_days...

## Query including TOP and AVG

sql,sql-server,average
This is the last problem I have to deal with in my application and I hope someone will help because I'm clueless, I did my research and cannot find a proper solution. I have an 'University Administration' application. I need to make a report with few tables included. The problem...

## current average for each row of data

mysql,average
I have a table output with as-Date   Output 1-Jan  20 2-Jan  40 3-Jan  30 4-Jan  100 5-Jan  120 6-Jan  10 7-Jan  90 8-Jan  80 9-Jan  60till 31-Dec  120 I need to query the average of each date where the average is the culmilative average of values from 1st date to current date as below- Date   Output  Average 1-Jan  20  20 2-Jan  40  30...

## Averaging rows by multiple column variables in R

r,ggplot2,average,bar-chart,multiple-columns
I am trying to create a multiple bar chart of my data, depicting the mean of avgct for each region with error bars using ggplot2. Here is a sample of my data: gregion lregion avgct 1 e 1.146 1 e 0.947 2 e 0.908 3 e 1.167 1 t 1.225...

## Average day of month from list of dates in PHP

php,date,average
I'm trying to find the average date and guess the next one. The input is a list of dates that looks like this: \$completeDate = array( '2015-04-13T00:00:00-0800', '2015-03-20T00:00:00-0800', '2015-02-17T00:00:00-0800', '2015-01-10T00:00:00-0800' ); I'm trying to scan a list of x amount of dates, and output an average of the dates overall....

## deleting a name from a list input by user and averaging a class score

python,list,class,average
I've read lots of tutorials on Python and am currently in an intro to programming class using python, but I can't figure this out. I've searched stack overflow, dani web, java2s, github and many others but can't understand what I'm doing wrong. This is for a final project in my...

## calculating averages across array indices and collecting results to a new array

java,arrays,average
I'm trying to run the averaged perceptron which takes all the weight vectors created during each iteration and then, for instance, for the first index, it will take the average across all weights associated with index 1 in all of the iterations that preceded the converagance and use this average...

## Daily Average to monthly total in R

r,average,totals
Date DE VE 12/1/2016 93.387 0.095 11/1/2016 77.968 0.095 10/1/2016 65.184 0.095 9/1/2016 63.984 0.095 8/1/2016 67.657 0.095 %m/%d/%Y DE and VE are daily averages. How to convert from daily average to monthly total in R based on the actual days in that month? Total for 12/2016 =93.387*31. Need to...

## take the average of each index in a double[] hash map and assign it to an output double[]

java,hashmap,average
I want to implement the averaged perceptron algorithm, in accordance with this description (page 48, complete with psuedocode). I think I'm pretty close, but I'm having trouble trying to figure out the last step wherein I need to compute the average of the weights calculated during every iteration for each...

## Calculate the average of fields in MongoDB

mongodb,average,aggregation
I want to calculate the rating_average field of this object with the rating fields inside the array ratings. Can you help me to understand how to use aggregation with \$avg? { "title": "The Hobbit", "rating_average": "???", "ratings": [ { "title": "best book ever", "rating": 5 }, { "title": "good book",...

## Awk average of n data in each column

awk,average
"Using awk to bin values in a list of numbers" provide a solution to average each set of 3 points in a column using awk. How is it possible to extend it to an indefinite number of columns mantaining the format? For example: 2457135.564106 13.249116 13.140903 0.003615 0.003440 2457135.564604 13.250833...

## mongo DB average difference

mongodb,average,difference
I am struggling with a MongoDB query in some homework. I am very new to MongoDb and so far only understand the basics. Here is the question: Suppose that we have full-time results data since 2001-08-01 for a variety of football competitions in a mongo database collection results which has...

## OrientDB average over collection

sql,aggregate,average,orient-db
Im trying orientdb with some simple apps. In this app I have People (persona) and places to eat (sitio), people go to those places (I store how many times they do) and score them. Using this query: SELECT *, inE('puntua').comida as comida, inE('puntua').servicio as servicio, inE('puntua').extras as extras from Sitio...

## If I have three different text file how do I read them then sort them by average?

python,file,sorting,text-files,average
I am currently writing a code where you ask maths questions. I have saved the students score along with their name in different folders for 3 different classes. Then I have three different files for each test they have done. I want a code that checks if their name is...

## SQL: Time Dimension and Calculating Averages

sql,sql-server,average,dimensional-modeling
Although not exactly the same, I have a SQL Server 2008-R2 database schema that pretty much looks like this... I'm struggling to get my head round how I would query the DB to get the average number of product sales of a over a given time frame? Eg, What's the...

## Avoiding CPU Contention

c++,cpu,average,chrono
I have a program that I want to calculate its time of execution : #include <iostream> #include <boost/chrono.hpp> using namespace std; int main(int argc, char* const argv[]) { boost::chrono::system_clock::time_point start = boost::chrono::system_clock::now(); // Intructions to burn time boost::chrono::duration<double> sec = boost::chrono::system_clock::now() - start; cout <<"---- time execution is " <<...

## Trying to get an average from a dictionary of results [duplicate]

python,average
This question is an exact duplicate of: Sum function prob TypeError: unsupported operand type(s) for +: 'int' and 'str' 4 answers For this code I am trying to get the overall average of a class. I would open the file and then remove all characters and line strips from...

## I need to know how to sort my dictionary on python by aveage scores with students with multi-ple scores?

python,sorting,dictionary,average
I have scores of names of pupils in my class who took a quiz. ome took more than one and I want to work out the average using python. I saved the scores in a textfile but im not sure how to programme it so it sorts it by there...

## What's wrong with my nested for loop in R?

r,for-loop,matrix,average,moving-average
fname = file.choose() two = read.csv(fname.header=T) rec = two\$Receipt del = two\$Delivery date = two\$Date net = rec-del yrec = matrix(rec,nrow=365,ncol=4,byrow=F) ydel = matrix(del,nrow=365,ncol=4,byrow=F) ynet = matrix(net,nrow=365,ncol=4,byrow=F) yrecsum = 0 yrecavg = 0 for(i in 1:4) { for(j in 1:365) { yrecsum[i] = yrecsum[i]+yrec[j,i] } yrecavg[i] = yrecsum[i]/365 } So...

## Assembly Procedures not running Intel 8086

sorting,assembly,average,procedure,8086
The code below, is supposed to get 20 user-entered numbers (6 digit numbers or less) and compute the average as well as sorting them, When I set it to get 6 or less numbers, it works fine. But when it is set to get 7-20 numbers, after getting the numbers,...

## Calculating average of floats rounded to an integer NASM

arrays,assembly,floating-point,average,nasm
Basically the program is suppose to input floating point numbers from the user, then get the sum of them, the average of them (from 0.0 to 100.0), anything above is not counted and anything below isn't counted as well. A negative number will not just not be counted but also...

## Inner join and Avg( ) function

sql,sql-server,inner-join,average
I am using sql-server.I have a table looks like StudentName Class score Jim a1 80 Ann a1 83 Bill a2 90 I want to select student whose score is above the average score in his/her class. Here is my code: Select a.StudentName From Table a inner Join Table b On...

## How to efficiently compute average on the fly (moving average)?

algorithm,math,average,moving-average
I come up with this n=1; curAvg = 0; loop{ curAvg = curAvg + (newNum - curAvg)/n; n++; } I think highlights of this way are: - It avoids big numbers (and possible overflow if you would sum and then divide) - you save one register (not need to store...

## Group similar data from multiple tables and add result

php,mysqli,sum,average
I want to be able to show the number of items the client has and the total for them, and add the prices for each itemid and total price. I am not able to workout the logic for how to do that. So far i can show all the items...

## Calculate the average for an arbitrary number of arguments

javascript,numbers,average
I'm trying to calculate a function that will return the average for an number of integer arguments. Who can help? var Calculator = { average: function(x) { var num = 0; for (var i = 1; i <= x.length; i++) num = num + x[i]; var divide = num/x.length; return...

## MySql AVG() and WHERE

php,mysql,where,average
I'm struggling on how to write this query and cant quite find an answer to help me with my case. Consider the following table: ----------------------------------------------- | ID | Value1 | Value2 | Value3 | Date | ----------------------------------------------- | 1 | 10 | 23 | 30 | 2015-01-01 | ----------------------------------------------- |...

## MySql returns not correct AVG

mysql,sql,average
Table: Column | Type ------------------------------------------- Project_ID | INT AI ------------------------------------------- Rejection_Rate | double ------------------------------------------- Data: Proj Name | AVG Value ------------------------------------------- Project1 | 100 ------------------------------------------- Project2 | 200 ------------------------------------------- Project2 | 100 ------------------------------------------- MySql Query: SELECT concat(Project_ID,'-',Project_Name) as `Proj Name`,...

## Python, Pandas: average every 2 rows together

python,pandas,average,rows
pretty basic question, but was wondering: What is the 'proper' way to average every 2 rows together in pandas Dataframe, and thus end up with only half the number of rows? Note that this is different than the rolling_mean since it reduces the number of entries....

## PYTHON: Finding the average of values of a nested list

python,list,average,mean
I have a list: data=[ [["apple",2]], [["cake",5],["cake",8]], [["chocolate",3],["chocolate",9],["chocolate",10]],[["grapes",6]] ] This list (data) consists of lists (data[x]), which consists of lists (data[x][x]) containing the same word together, each with a number with it. I want to find the average of the number for each word (any floats rounded to integer). For...

## Average Row/Column Data in a Text File

linux,unix,awk,sed,average
I need to average three columns of data that are in a row in a text file. Data: VALID_TIME STN CDF05 CDF10 CDF20 CDF30 CDF40 CDF50 CDF60 CDF70 CDF80 CDF90 CDF95 MEAN SD 2015031018 KMGM 50.3 51.5 52.9 54.0 54.9 55.8 56.7 57.6 58.6 60.1 61.3 55.8 3.3 2015031106 KMGM...

## How to look up (or match) two criteria and then average any value that matches those two criteria

I have two sheets. On sheet #1, column A is made up of publishers (publisher 1, publisher 2, publisher 3, etc.), and row 1 is made up of topics (topic 1, topic 2, topic 3, etc.). On sheet #2, column D lists the publishers, and column F lists the topics...

## R: Average pairs of columns in a matrix

r,matrix,average
I have a large matrix made up of many columns. I would like to get a new matrix with the same number of rows and half the number of columns by averaging every nearby 2 columns (for example column 1 with 2, column 3 with 4, etc). Now I'm using...

## python 3 IndexError: list index out of range

python,list,csv,python-3.x,average
My problem is that the average value on this won't show up as it returns as an error Traceback (most recent call last): (file location), line 29, in <module> average_score = [[x,x] for x in a_list] (file location), line 29, in <listcomp> average_score = [[x,x] for x in a_list] IndexError:...

## SQL- How to find average of a column using values only in last N rows

mysql,sql,average
I have a data table which looks like this. datestamp timestamp vix 2015-05-13 16:30:00 18.0 2015-05-14 16:30:00 19.2 2015-05-15 16:30:00 18.5 2015-05-18 16:30:00 17.5 2015-05-19 16:30:00 17.0 I want to get the average(avg()) of the column vix for last 3 days. I know how to get last 3 rows using...

## Excel three column duplication and averaging

excel,duplicates,average
I need to average data (3rd column) corresponding to a specific latitude and longitude(1st and 2nd columns). The results are then outputted to columns 4,5,6. Sample data and manual analysis is posted bellow. I think I need Index, Iferror or Vlookup. Most of the other questions dealing with this kind...

## SQL Server query - Min, Max, Avg aggregates issue

sql,sql-server,max,average,min
I would like to have some statistic data (min, max, average) from a database but I am currently facing a problem. I think the syntax is incorrect but I am not sure. I can not get expected results. Here is the table; name period b c ----------------------------- KONYA July -...

## What does illegal character in numeric field error concern for Cobol using Unix system?

average,numeric,cobol
How to solve the error: Execution error : file 'prog3.int' error code: 163, pc=177, call=1, seg=0 163 Illegal character in numeric field IDENTIFICATION DIVISION. PROGRAM-ID. prog3. ENVIRONMENT DIVISION. Input-output Section. File-Control. select input-file assign to "/home1/c/a/acsi203/realestate.dat". select output-file assign to "prog3out.dat" organization is line sequential. DATA DIVISION. File Section. FD...

## how to calculate the average of an array by range 10? [closed]

python,arrays,algorithm,average
i am trying to find the average of an array by range 10 in a sorted array, for example : [1,2,3,5,11,12,13,15,22,25,27,30] should return [6,17,27] the function is supposed to groupe the numbers by a range of 10 and make the average between [1,2,3,5,11] = (1+11)/2 =6 [12,13,15,22]= (12+22)/2 =17 [25,27,30]...