max

Finding Maximum Value in CSV File

五迷三道 提交于 2019-12-31 07:38:10
问题 Have an assignment of finding average and maximum rainfall in file "BoulderWeatherData.csv". Have found the average using this code: rain = open("BoulderWeatherData.csv", "r") data = rain.readline() print(rain) data = rain.readlines() total = 0 linecounter = 0 for rain in data: linecounter = linecounter + 1 print("The number of lines is", linecounter) for line in data: r = line.split(",") total = total + float(r[4]) print(total) average = float(total / linecounter) print("The average rainfall

Count lines (max) with values

狂风中的少年 提交于 2019-12-31 07:12:10
问题 I would like to count the lines that have values. I tried oSheet.Rows.Count but that doesn't work. Any idea about this? My code is the following: Dim oExcel As Object Dim oBook As Object Dim oSheet As Object oExcel = CreateObject("Excel.Application") oBook = oExcel.Workbooks.Add oSheet = oBook.Worksheets("Sheet") oSheet.Range("A" & max).Value = "0000111" oSheet.Range("B1").Value ="Name" oBook.SaveAs("C:\New folder\excel\" & datenw & ".xlsx") oExcel.Quit() 回答1: As said in the comments, the

SPARQL selecting MAX value of a counter

点点圈 提交于 2019-12-31 04:37:08
问题 I'm new to sparql and trying to fegure out what is the best way to select the max value of a counter of another query without creating a new table, only using sub-queries. I'm working on a relatively small dataset so the computation time is not a problem. SELECT ?p1 ?c1 (MAX(?cnt1) AS ?maxc) WHERE{ { SELECT ?p1 ?c1 (COUNT(?s1) AS ?cnt1) WHERE { ?s1 ?p1 ?o1; a ?c1. }Group by ?p1 ?c1 #ORDER BY ?p1 DESC(?cnt1) } }GROUP BY ?p1 so I'm expecting to get a row for every value of ?p1 with the max

how to eliminate outlier in spotfire box plots

旧巷老猫 提交于 2019-12-30 11:15:11
问题 Thanks for your help in advance. Regards, Raj 回答1: Adding the values to MAX() values would skew the data even if it were possible. There are two hacks to do this though. Right Click > Properties > Y-Axis > set the MIN range value and MAX range values to something that would eliminate all outliers. This is really only suitable for box plots that are close in all values to each other (all percentiles) On your toolbar click Insert > Calculated Column > choose the correct data table and paste in

How to get MAX value of a version-number (varchar) column in T-SQL

橙三吉。 提交于 2019-12-30 10:39:21
问题 I have a table defined like this: Column: Version Message Type: varchar(20) varchar(100) ---------------------------------- Row 1: 2.2.6 Message 1 Row 2: 2.2.7 Message 2 Row 3: 2.2.12 Message 3 Row 4: 2.3.9 Message 4 Row 5: 2.3.15 Message 5 I want to write a T-Sql query that will get message for the MAX version number, where the "Version" column represents a software version number. I.e., 2.2.12 is greater than 2.2.7, and 2.3.15 is greater than 2.3.9, etc. Unfortunately, I can't think of an

Mysql min and max values and corresponding “date” for each month

痴心易碎 提交于 2019-12-30 10:38:12
问题 I have a table named "rates" and it has two fields "date" and "rate". I like to get MIN and MAX rate values and their dates on which they occurred for each month. But I could not manage. SELECT date, MIN(rate) AS minRate, MAX(rate) AS maxRate, MONTH(date) AS monthName, YEAR(date) AS yearName FROM rates GROUP BY yearName ASC, monthName ASC Clarification: I like to get something like this: Months MIN mindate MAX maxdate Jan 1.234 2012-01-13 1.534 2012-01-24 Feb 1.165 2012-02-28 1.373 2012-02-11

Get maximum value from all matrices in a list

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-30 09:45:47
问题 I've created a List of matrices, and now I want to get the maximum values of row in all matrices, how do I get them? Here is the code for the list: i <- 1 tryList <- list() treeList <- list() accList <- list() for(t_mtry in 1:40){ for(t_ntree in 20:300{ rf <- randomForest(class ~., data=training, mtry=t_mtry, ntree=t_ntree) tbl <- table(predicted = predict(rf,evalSet,type="class"),actual=evalSet$class) #get the accuracy of the classification as a list retVal <- accuracy(tbl) tryList <- c

find all indices of max values matlab

只谈情不闲聊 提交于 2019-12-30 08:34:23
问题 I just want to find all the indices of the maximum value in a vector in matlab. the max function returns only the index of the first occurence of the maximum. For example: maxChaqueCell = [4 5 5 4] [maximum, indicesDesMax] = max(maxChaqueCell) maximum = 5 indicesDesMax = 2 I need the indicesDesMax to have 2 and 3 which are the indices of the two 5 we have in maxChaqueCell , how can I do that? Thanks. 回答1: First you find the max value, then you find all the elements equal to that: m = max

find all indices of max values matlab

夙愿已清 提交于 2019-12-30 08:34:08
问题 I just want to find all the indices of the maximum value in a vector in matlab. the max function returns only the index of the first occurence of the maximum. For example: maxChaqueCell = [4 5 5 4] [maximum, indicesDesMax] = max(maxChaqueCell) maximum = 5 indicesDesMax = 2 I need the indicesDesMax to have 2 and 3 which are the indices of the two 5 we have in maxChaqueCell , how can I do that? Thanks. 回答1: First you find the max value, then you find all the elements equal to that: m = max

How set 0 with MAX function when it is NULL?

感情迁移 提交于 2019-12-30 01:45:06
问题 I would like to understand how to set 0 value of the attribute when it is NULL with MAX function. For example: Name columns: number - date Values: 10 - 2012-04-04 11 - 2012-04-04 12 - 2012-04-04 13 - 2012-04-15 14 - 2012-06-21 1 - 2013-07-04 Number is incremental field, but it has set itself 1 when new year has come. But result of: SELECT (MAX(number)+1) number WHERE date LIKE "2014%" is NULL and not 1 because MAX(number) is NULL and not 0 回答1: Well, as there is no date like 2014, you would