I am using Python and I have a black and white .FIT image file that is 2048 x 2048 pixels and each pixel has a single value. I need to find the standard deviation of the pixel values for the first 64 columns. By this i mean, i need to...

This question already has an answer here: How to sum a variable by group? 7 answers I would like to calculate the mean of a data.frame by two variables. See an example of the data.frame (extraction) below: Station Time Year Month Value ARO 199501 1995 1 69 ARO 199502...

Below is a sample of my data: Dates User1 User2 User3 Jan-15 10 54 1 Feb-15 25 85 25 Mar-15 69 65 65 Apr-15 56 32 41 I do not want to manually make any changes in the excel file. How can I write an R code to calculate the...

I'm using MEAN stack where I have users which can build charts. where `user, chart` = mongoose schemas My questions is how can I link the charts created by users with the user itself so I can display the past created charts on the admin page? var ChartSchema = new...

I have a big continuous array of values that ranges from (-100, 100) Now for this array I want to calculate the weighted average described here since it's continuous I want also to set breaks for the values every 20 i.e the values should be discrete as -100 -80 -60...

I know this is a stupid question, but I'm missing something and I'm lost. I have created a new project using 'yo meanjs' thus creating the standard scaffolding. From the public side of the application I am trying to search the Users for a user based not on their id...

I have a time series of regular 15 minute data intervals and I want to take a rolling average of the data for every 2 hours, hence the width of the rollmean interval would be 8. The only issue is that the length of the original time series that I...

I am very new to R Programming, I am triyng to calculate the mean of z[1] and keeping 70=<z[2]<=72 by the way z[1] includes NA s. I try this mean([z[1]!is.na(z[1])]& 70 =<z[2]<= 72) but does not work. If you help me , I would really appreciate. Thanks...

Can anyone provide me the links of weather APIs which will provide weather forecast based upon the longitude and latitude?

I have a df like this: cluster org time 1 a 8 1 a 6 2 h 34 1 c 23 2 d 74 3 w 6 I would like to calculate the average of time per org per cluster. Expected result: cluster mean(time) 1 15 ((8+6/2)+23)/2 2 54 (74+34)/2...

Recently I began to use MeanJs, it's pretty amazing but I don't understand some stuff. I need to create a simple user management for my backend. From official blog they say: New usability features: Added roles to the User model - the defaults are ‘user’ and ‘admin’, you can add...

Looking over some MATLAB code related to multivariate Gaussian distributions and I come across this line: params.means(k, :) = mean(X(Y == y, :)); Looking at the MATLAB documentation http://www.mathworks.com/help/matlab/ref/mean.html, my assumption is that it calculates the mean over the matrix X in the first dimension (the column). What I don't...

I have a 3D array like this: a = ([[[25, 4, 54], [58, 14, 27], [35, 40, 62], [53, 72, 86], [87, 4, 51], [89, 34, 22]], [[61, 99, 89], [52, 93, 18], [ 0, 38, 12], [99, 10, 98], [79, 91, 75], [31, 59, 3]], [[22, 9, 63], [37,...

I'm building a MEAN app. This is my Username schema, the username should be unique. var mongoose = require('mongoose'); var Schema = mongoose.Schema; module.exports = mongoose.model('User', new Schema({ username: { type: String, unique: true } })); On my post route I save the user like this: app.post('/authenticate', function(req, res) {...

I work with an image that I consider as a matrix. I want to turn a 800 x 800 matrix (A) into a 400 x 400 matrix (B) where the mean of 4 cells of the A matrix = 1 cell of the B matrix (I know this not a...

i'm quite new in programming with pyhton and I hope anyone of you is in mood to help me. Well, i have many differnt climate stations with solar radiation measurements in a 1 minute and also in 10 minutes time resolution. The measurements contains also Na values. Now I'd like...

Trying to install mongoose on windows 7. I have searched all other stackoverflow question related to my queries.Nothing works for me. updated the npm version to 2.4.1 If any one can help on this. below is my error log From Installation command prompt C:\Program Files\nodejs>npm install mongoose | > [email protected]

Let's say I have this zoo object: library(zoo) df <- structure(list(date = structure(c(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 396, 424, 455, 485, 516, 546, 577, 608, 638, 669, 699, 730, 761, 790, 821, 851, 882, 912, 943, 974, 1004, 1035, 1065, 1096, 1127,...

I have a minor problem, and I'm unsure how to fix the error. Basically, I have two columns and I want to use a Double For Loop to calculate the averages between each number in both columns so it results in a vector of averages. To clarify, apply and mean...

I calculated a mean angle of below two angles. 337.477792 324.8119785 I used the formula to calculate a mean angle (see below #Distribution of the mean) http://en.wikipedia.org/wiki/Directional_statistics What I got was 28.85511475 / -28.8551147. The values don't look right ... Wonder if someone can explain this result for me? Thank...

I have a problem calculating the mean of columns for a dataset imported from this CSV file I import the file using the following command: dataGSR = read.csv("ShimmerData.csv", header = TRUE, sep = ",",stringsAsFactors=T) dataGSR$X=NULL #don't need this column Then I take a subset of this dati=dataGSR[4:1000,] i check they...

I have this data frame (adjusted from @Vinterwoo's code), and I'm looking for a function to get the mean per group for each column. So the mean for group A in column C1 and C2, and the same for group B etcetera. I know how to get the mean per...

Have a question with regards to the default meanjs app from yeoman. Inside the express.js file it has a statement like so: // Globbing model files config.getGlobbedFiles('./app/models/**/*.js').forEach(function(modelPath) { require(path.resolve(modelPath)); }); Now I understand that it gets all the .js files inside the path "./app/models/", but what I am trying to...

I have this nice pandas dataframe: And I want to group it by the column "0" (which represents the year) and calculate the mean of the other columns for each year. I do such thing with this code: df.groupby(0)[2,3,4].mean() And that successfully calculates the mean of every column. The problem...

I think I have an error in my logic while reproducing a graph I found in this pdf here. It should be fairly easy to do, but I have issues to plot a variable with its mean and standard deviation each in their own graph together, as can be seen...

This question already has an answer here: Joining aggregated values back to the original data frame 5 answers I have what I fear may be a simple problem, to which I almost have the solution (indeed, I do have a solution, but it's clumsy). I have a data frame...

I have data that looks like: require(data.table) DT <- data.table(x=c(19,19,19,21,21,19,19,22,22,22), y=c(53,54,55,32,44,45,49,56,57,58)) I would like to search along x, and calculate the means for y. However, when using. DT[, .(my=mean(y)), by=.(x)] I get the overall means for the coinciding values of x. I would like to search along x, and each...

I'm setting up a user registration within a MEAN app. However, I'm struggling with error handling, especially with Mongoose validation. In the following code, when I provide a wrong email to my API, exception thrown by mongoose is not caught in my block. try { User.save(function (err, user) { if...

I'm having trouble running this double for loop to properly store the calculated values into the matrix (mentioned below). The reason why I elected to use the double For Loop and not apply() or mean() is that I want to obtain the unique combinations of the two columns and eliminate...

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...

This question is asking which command to use given the following situation: Objective: Calculate mean of iris$Sepal.Length. Constraint: Do not include the iris$Species 'setosa'. My Work: data(iris) levels(iris$Species) output: setosa, versicolor, and virginica mean(iris$Sepal.Length, which(iris$Species != 'setosa')) output: error message 'incompatible dimensions' --- This demo is a stand-in for my...

Here, I present a simple problem that requires a Double For Loop and an If Else statement. My first question is assistance with minor troubleshooting, and my second question is more curiosity driven in that I am interested in a shorter, more elegant solution. In the case of the first...

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...

I have 25 time series of monthly returns of different portfolios as columns (S1B1, S1B2, S1B3, S1B4, S1B5, S2B1, S2B2, S2B3, S2B4, S2B5, (...), S5B5): S1B1 S1B2 S1B3 S1B4 S1B5 (...) S5B5 0.2 0.1 2.1 3.2 1.2 0.3 0.3 1.2 2.6 2.1 6.3 0.2 0.5 0.5 0.5 2.2 6.2 1.2...

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...

I have two different lists of experiments with three columns. I want to merge the lists in only one, but if they have the same first and second element, perform the mean between the thirds values, take that results and remove the other two. Example: List 1: [[ 2, '+',...

I have a dataframe consisting of a series of paired columns. Here is a small example. df1 <- as.data.frame(matrix(sample(0:1000, 36*10, replace=TRUE), ncol=1)) df2 <- as.data.frame(rep(1:12, each=30)) df3 <- as.data.frame(matrix(sample(0:500, 36*10, replace=TRUE), ncol=1)) df4 <- as.data.frame(c(rep(5:12, each=30),rep(1:4, each=30))) df5 <- as.data.frame(matrix(sample(0:200, 36*10, replace=TRUE), ncol=1)) df6 <- as.data.frame(c(rep(8:12, each=30),rep(1:7, each=30))) Example <-...

I am experimenting with the MEAN stack, specifically with MEAN.js. While everything is pretty well explained in the documentation, it seems that the simple task to associate an entity (or Model) with another isn't explained in the documentation or the examples. For example, it is easy to generate a crud...

I've been trying to calculate the mean of the third, fourth and fifth values in each row of a .csv file, but my program will only calculate for the first row rather than for each row. For example, this code: file=open("file.csv", "r") data=csv.reader(file) data=[[row[0],row[1],eval(row[2]),eval(row[3]),eval(row[4])] for row in data] from statistics...

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,...

I'm new in gnuplot and sorry that my problem formulation might be unprecise, but I don't know how to find the tools/commnds needed to solve my problem. The code for plotting I would like to integrate in my bash file. I have a data set like: 285 1 50 7.35092...

I have a sorted vector of numeric values and I would like to create a new vector containing the midpoints of all the pairs. For example: a <- c(1,2,3,4) I want to create b such that it contains the midpoint of (1,2), (2,3) and (3,4): b <- c(1.5, 2.5, 3.5)...

I tried to deploy MEAN on the Google Developers Console and it keeps on failing. I tried change the zone and still doesn't work. Creating deployment Jan 25, 2015, 10:16:40 PM meanStackBox: PENDING Jan 25, 2015, 10:16:51 PM ... Jan 25, 2015, 10:21:04 PM meanStackBox: DEPLOYING Jan 25, 2015, 10:21:15...

I have this simple gulpfile that basically compiles some less files and triggers livereload. I also have nodemon to restart the server when code is changed. var gulp = require('gulp'), less = require('gulp-less'), autoprefixer = require('gulp-autoprefixer'), minifycss = require('gulp-minify-css'), jshint = require('gulp-jshint'), uglify = require('gulp-uglify'), // imagemin = require('gulp-imagemin'), rename...

This question already has an answer here: Calculating mean when 2 conditions need met in R 2 answers Below is the script to generate a reproducible dataframe: id <- c(1:20) a <- as.numeric(round(runif(20,-40,40),2)) b <- as.numeric(round(a*1.4+60,2)) df <- as.data.frame(cbind(id, a, b)) i would like to calculate the mean of...

I've just spent the last many hours debugging a problem that occurs after atom beautification. My question regards why would the following be an issue. This is a snippet of code in the MEAN.js scaffolding in the file layout.server.view.html: (I dont know what this code does... but that's a different...

I am not used to code with Python, but I have to do this one with it. What I am trying to do, is something that would reproduce the result of SQL statment like this : SELECT T2.item, AVG(T1.Value) AS MEAN FROM TABLE_DATA T1 INNER JOIN TABLE_ITEMS T2 ON T1.ptid...

I have a data set with columns that follow a certain prefix and suffix pattern and want to create column means systematically. To create a 6 day average for no2 df$no26 <- rowMeans(subset(df, select = c(no2_1,no2_2,no2_3,no2_4,no2_5,no2_6))) and a 5 day average for bc would be created with: df$bc5<- rowMeans(subset(df, select...

I have a data frame DF <- data.frame(y1=c("AG","AG","AI","AI","AG","AI"), y0=c(2,2,1,1,2,1), y3=c(1994,1996,1997,1999,1994,1994),y4=c("AA","FB","AA","EB","AA","EB"), mw3wuus=c(26,34,22,21,65,78), Country_true=c("Antigua and Barbuda","Antigua and Barbuda","Anguilla","Anguilla","Antigua and Barbuda","Anguilla")) DF y1 y0 y3 y4 mw3wuus Country_true 1 AG 2 1994 AA 26 Antigua and Barbuda 2 AG 2 1996 FB 34 Antigua and Barbuda 3 AI 1 1997 AA 22 Anguilla...

I'm trying to calculate the mean of a large df, dividing observations by Id and month and none of the answers I found work as I expect, sometimes they empty my sample and that's not useful. If df is: permno company amihud illiq MonthYr 10026 J & J SNACK FOODS...

I'm trying to calculate per-column mean for matrix using Matlab and see strange behaviour. Matlab calculates mean() for the first and second columns, but doesn't calculate it for the rest columns. Example: >> Z = [2104 4426816 3 9; 1600 2560000 3 9; 2400 5760000 3 9] Z = 2104...

I have a data frame with different observations in three compartments (COMP1, COMP2 and COMP3) for ten products (PRO01-PRO10) and for three different treatments (A, B and C). My data is this: TRA PRO COMP1 COMP2 COMP3 A PRO01 2.98 6.35 45.57 A PRO01 2.97 9.17 66.52 A PRO01 3.83...

I need to calculate the mean of the first column of the dataframe and I can do that using the mean() method. The problem: Sometimes, there are -9999 values in the data denoting missing observations. I know that NaN values are inherently skipped when calculating the mean in Pandas, but...

for example lets consider a = fix(8 * randn(10,5)); and mean(a) would give me mean of each column. So, what I was planning to do was comparing the mean of first column to each of its content till the column and and proceed to the next column with its mean...

I got this two functions Function 1 $scope.selected = []; $scope.selected.project = ['name:test, id:1']; $scope.selectedFs = function($item, $model) { $scope.selected.project = [$model]; console.log($scope.selected.project[0]); } }; Function 2 $scope.create = function() { var sign = new Sign ({ sig: document.getElementById('canvas').toDataURL(), projectId: $scope.proid, project: $scope.selected.project[0], timesheetId: $scope.timesheetsId }); console.log($scope.selected.project[0]); sign.$save(function(response) { },...