Questions tagged [min]

Minimum value. Smallest, tiniest, least.

min
Filter by
Sorted by
Tagged with
0 votes
1 answer
74 views

Get key for min value in python dict of class objects

I have a custom class (simplified) like this: class SoftMatch: def __init__(self, time_d): self.time_delta = time_d and a dict with instances of this class: softmatches = {"...
Nicklas Blidmo's user avatar
0 votes
1 answer
57 views

Minimum value of a column based on NA's in other column by group

I have a large dataset with 40 variables for 20 countries where some columns have NAs in the first (and last) years. I would like to extract the first and last year for which there is no NA in a ...
karlakolumna's user avatar
0 votes
3 answers
860 views

Get MIN, MAX, AVG value with datetime for each DAY (MySQL)

I have a MySQL database with lots of entrys with columns like "local_time", "temp", "wind", etc. What I want to archive is get in just one query the MIN value for temp, ...
cbn's user avatar
  • 21
-1 votes
1 answer
82 views

Is there mistake in my code of printing highest and second highest number from array?

from array import * array1 = array('i', [10,5,99,88,99,99,10,12,9,9,13,45,45,18,21,13,13,22,99]) #array2 = array('i', [10,5,99,88,99,99,10,12,9,9,13,45,45,18,21,13,13,22,99,88]) print(array1[len(...
Arvind SHa's user avatar
0 votes
2 answers
168 views

How to get rows with minimum ID on a multiple columns query

I have a table like this: Id Type multiple columns (a lot)... 1 50 2 50 3 50 4 75 5 75 6 75 I need to get only the rows with the older (min) id as a part of my query. The result should include ...
Fernando Álvarez's user avatar
0 votes
1 answer
51 views

Find min date from a column which has values DD-MMM-YY format stored as string

One of the column(file_date) in a table is of type string and has values of dates in DD-MMM-YY format. How do I find min(date) from the column. I wrote simple query Select min(file_date) from ...
Xenon's user avatar
  • 11
0 votes
1 answer
44 views

Selecting max value between columns and replacing non min values to 0

I have 4 columns in table that each have different category values. I would like to find the maximum value between the columns and keep only that while turning all other values to 0. How can I go ...
Trevor M's user avatar
-1 votes
1 answer
59 views

C output confusion

I'm trying to learn some C, but it's a pain. I have this task: 'Write a C program to determine the minmum and maximum of a sequence of integer numbers on input, terminged by the string "done"...
bjj's user avatar
  • 41
0 votes
1 answer
41 views

eliminating a whole group which doesn't meet minimum date - SQL Spark

I have a table with order ID, Country, order date, product name and quantity. As you can see one unique order ID is composed of a few products/records but spread around different dates. I need my ...
user17312322's user avatar
0 votes
2 answers
364 views

TypeError: 'dict_keys' object is not callable

I have used the below program to get the maximum and minimum value in a dictionary. But, there is an type error. I am running the below code on Jupyter notebook and getting the type error as the '...
Priya Raut's user avatar
0 votes
3 answers
174 views

How to select the row with the minimum value of a column while the other column is at its maximum? [closed]

In SQL, how can I select the minimum value of a column a (integer) where the column b (integer) is the maximum value for that column, using only one select ? SELECT MIN(a) OVER (PARTITION BY MAX(b)) ...
Victor's user avatar
  • 345
0 votes
0 answers
76 views

How can I generate the data so that there is only one mode?

I want to make the mode of a set of data and for this I use the function "max". How can I indicate that if there is more than one value that is the maximum it repeats the operation, and that ...
Amelia's user avatar
  • 139
0 votes
1 answer
28 views

How to obtain the maximum/minimum value of a column and its corresponding index?

I have a table as follows (just to give an example): date ret1 ret2 2022.01.01 0.2844 0.9768 2022.01.02 0.1531 0.5791 2022.01.03 0.6683 0.418 2022.01.04 0.6441 0.8265 2022.01.05 0....
dbaa9948's user avatar
  • 375
-5 votes
1 answer
98 views

Replace elements of array C with units [closed]

I have a one-dimensional array where I need to replace the array elements after the smallest element with one, but I don't know what I need to write to make this condition work? I will be grateful for ...
Who is Antonio's user avatar
0 votes
2 answers
142 views

Finding min and min with nested array

I'm wanting to find the min and max value of values inside a nested array, however the nested array has strings and numbers I'm able to find min and max when using a variable of just the numbers but ...
user avatar
1 vote
1 answer
31 views

Can I use the minimum value of a column created with AS?

In my task I needed to create a new column that shows how many singers are in some specific bands. So far I did this in the SELECT section: SELECT bands.name, count(\*) AS singernumber FROM.... So my ...
Viktória Szathmáry's user avatar
0 votes
1 answer
87 views

Get the minimum of a generic List<T>, T extends Comparable

current.getValues(); returns a List of the generic T List<T> val = current.getValues(); return val.stream().min(????) What do I have to fill in the brackets at return val.stream().min(????)? ...
Relez_ 's user avatar
0 votes
2 answers
60 views

How can I make a PostgreSQL query faster so that it gives back the lowest values?

I have the following data: id1 id2 score 281 33453 23 281 33452 23 281 36466 24 282 12118 14 282 27603 18 How do I write my query in PostgreSQL in the most efficient way so that I keep all id2 ...
Liane's user avatar
  • 3
-1 votes
1 answer
187 views

Finding min and max value in a oop

Can I please get help with this java code? I am trying to output the min and max value of element from an array list but it's only outputting the first element added to the list and the last element ...
ennie Ayeni's user avatar
0 votes
2 answers
338 views

Python pandas Get daily: MIN MAX AVG results of datasets

Using Python with pandas to export data from a database to csv.Data looks like this when exported. Got like 100 logs/day so this is pure for visualising purpose: time Buf1 Buf2 12/12/2022 19:15:56 ...
UwUs's user avatar
  • 115
0 votes
2 answers
615 views

SnowFlake - How to return the column that the least function value came from?

I am doing a Snowflake query where I get RANK from each column. Output below: | Rank_A | Rank B | | -------- | -------- | | 1 | 3 | | 2 | 4 | | 5 | 4 | ...
gpak's user avatar
  • 21
3 votes
2 answers
61 views

How to divide value by max column for positive and negative data

I have a short matrix that represents in the below line: a b 1 2 5 -6 -3 -4 4 3 I want to get x/max(x) for the positive value and x/min(x) for the negative value. the ...
rezgar's user avatar
  • 114
0 votes
1 answer
63 views

SQL WHERE function filter-unexpected answer

The problem looks like this: Write an SQL query that selects the product id, year, quantity, and price for the first year of every product sold. Return the resulting table in any order. A simple ...
mmmmmm's user avatar
  • 53
5 votes
2 answers
101 views

can ranges min recalculations be avoided

Goal is to minimize a function over a range of input values. Performance matters. Unfortunately, the ranges::min() algorithm recomputes the output for the live optimum over and over again. It seems ...
Ludovic Aubert's user avatar
0 votes
0 answers
97 views

CSS - max-width Causes Spacing Issue In Parent

I have two DIVs on my site, both set to display: inline-block. Setting width: auto on the parent should cause it to use only the space occupied by the child. However, when I use a large width on the ...
Ood's user avatar
  • 1,724
0 votes
1 answer
47 views

SQL Select Minimum Value And Add Back To Table

TABLE1 STUDENT SUBJECT DATE WANT 1 HISTORY 1/1/2020 11/3/2019 1 HISTORY 11/3/2019 11/3/2019 1 HISTORY 12/1/2021 11/3/2019 2 HISTORY 3/4/2019 3/4/2019 2 HISTORY 2/6/2021 3/4/...
bvowe's user avatar
  • 3,300
0 votes
1 answer
30 views

Postgresql: how to get results count with min of a field and unique of b field?

I have a posgresql table as below: id session_id result 1 111 success 2 111 fail 3 111 fail 4 222 ...
Thomas Young's user avatar
1 vote
1 answer
65 views

How to extract first min value and second min value within a space of time

I am trying to select customers who have spent amount less than 15 in two consecutive occasions, first purchase must be less than 15, second purchase must be less than 15 and must be 90 days or more ...
Mikko's user avatar
  • 29
0 votes
2 answers
42 views

Why does my code not run correct with arr10 but work fine with arr9?

To get the minimum value in an array, I made the method minValue public int minValue() { int smallestVal = 0; //field if (intArray.length == 0) { //if array is empty, return 0 ...
nimi's user avatar
  • 1
0 votes
0 answers
93 views

Find first index smaller than list value (Isabelle)

Consider a set, say S = {7,0,4}, then sorted_list_of_set(S) = [0,4,7], call that list L. I want to return the smallest index,j, of L such that j < L!j, call that m. I suspect that requires ...
Squirtle's user avatar
  • 129
0 votes
1 answer
133 views

problem with min function in R getting error: InfWarning: no non-missing arguments to min; returning InfWarning: no non-missing arguments to min

I have been working with a data frame similar to the one below (though much larger. Every time I run the min function on this data frame when there are NA values I get this warning repeated thousands ...
sd3184's user avatar
  • 69
4 votes
0 answers
424 views

Minimum of maximums of non-contiguous subsequences of size k

Before I start: I hope this question is not a duplicate. I've found a couple of similar ones, but none of them seems to describe exactly the same problem. But if it is a duplicate, I will be glad to ...
user20276305's user avatar
0 votes
1 answer
648 views

How to find stat (min, max, quantile, etc) of a list without using pandas.series?

I have a variable list of elements. I want to be able to find, count mean std min 25% 50% 75% max . I know I can use pandas.Series.describe(). However, I have a restriction that I cannot use pandas ...
Droid-Bird's user avatar
  • 1,467
0 votes
1 answer
84 views

SQL - To find max and min salary from emp table along with emp name?

I need to find max and min salary for each department along with emp name . Below is my sample dataset. Expected output is : Please share your thoughts on this
Learn Hadoop's user avatar
  • 2,884
0 votes
0 answers
59 views

SQL - Postgres - How to return max and min value only for a column value - Unique table

I would like return only min value et max for id values. SELECT DISTINCT true_table.id_crsp , true_table.type_orientation as type_orientation_apres_requalif, CONCAT(to_char(true_table.ts_crea, 'DD-MM-...
user20538448's user avatar
0 votes
1 answer
185 views

Show the department number and the lowest salary of the department with the highest average salary

Show the department number and the lowest salary of the department with the highest average salary (use subquery). I want check my answer Is this correct answer? select min_sal, deptno, round(avg_sal)...
Aikul Tungyshbaeva's user avatar
1 vote
1 answer
96 views

How to find the minimum in JSON in Python

There is a part of a JSON file: { "payload": { "orders": [ { "quantity": 1, "platinum": 4, ...
KoraOnEarth's user avatar
0 votes
1 answer
40 views

Pandas .min() not getting lowest value per week

I have a dateframe with, for every hour for each day, the amount of gas and electricity used: elec gas day_of_week DuringBusinessHours ts 2022-04-30 01:00:...
Julius's user avatar
  • 37
0 votes
1 answer
20 views

mininum value of a resample (not 0)

i have a dataframe (df) indexed by dates (freq: 15 minutes): (little example) datetime Value 2019-09-02 16:15:00 0.00 2019-09-02 16:30:00 3.07 2019-09-02 16:45:00 1.05 And i want to resample my ...
ALbertittor's user avatar
0 votes
0 answers
27 views

Set a minimum and maximum int in a random number array (Java) [duplicate]

So I got an assignment, where the first problem is to set a minimum and maximum in an array which contains random numbers. I can figure out how to print the array with random numbers but I fail at ...
meltdown543's user avatar
1 vote
1 answer
302 views

How to create a column based on the min date of multiple columns?

print (df) Event1 Event2 Event3 0 7/27/2014 NaN NaN 1 3/5/2016 NaN 2/1/2013 2 5/13/2017 5/10/2013 NaN 3 NaN NaN 4/28/2014 4 NaN ...
weizer's user avatar
  • 1,073
0 votes
2 answers
450 views

Oracle SQL MAX() and MIN() with string

I'm having an issue retrieving the MAX number from database. The catch is that the numbers are in string format since they contain an underscore. Example case: I have 3 numbers in the database: ...
rgrz's user avatar
  • 23
0 votes
0 answers
11 views

How to print and find youngest in Java parallel arrays? [duplicate]

In two parallel arrays, String[] names and int[] ages, every name has a corresponding age and vice versa. Both arrays have the same length, say something like: String[] names = {“Alice”, “Paul”, “Jay”,...
jdona13's user avatar
  • 13
0 votes
1 answer
12 views

how to make highchart x axis meet y axis at min value of yAxis

i have a highstock chart and i set min value in yAxis, what i need is that xAxis line cross yAxis on specified min value of y axis, but there is a gap between them? yAxis: { opposite: true, ...
shahrooz bazrafshan's user avatar
0 votes
1 answer
12 views

Max and min in nupmy written laconic

What I want to achieve in Numpy: tmp = 10 - y * (X @ w) #some complex expression m = np.max(np.vstack([np.ones(tmp.shape), tmp]), axis=0) Do I can write this in one line? Something like 1 Max (10 - y ...
Arseniy Maryin's user avatar
-1 votes
2 answers
624 views

Find indexes of multiple minimum value in an array in c++

Please don't write that I should do my homework myself. I have tried but cannot find the answer. Input: arr[11]={1,2,3,4,1,5,6,7,8,1,9} Output: 0 4 9 Returned position numbers are to be inserted ...
jano's user avatar
  • 23
0 votes
2 answers
391 views

Get the rowwise minimum of certain columns excluding 0 and NA

I have made a very complex solution to something I feel should have a much simpler solution. In short what I want: I want to compute a new column containing the minimum value across 3 columns I want ...
Nina van Bruggen's user avatar
0 votes
2 answers
60 views

Merging lists/tuples stored inside a list in python

I have a list of lists each containing tuples with some co-ordinates which sort of look like this: [[(x1, y1), (x2, y2), (x3, y3) ... (xn, yn)], [(x1, y1), (x2, y2), (x3, y3) ... (xn, yn)], [(x1, y1), ...
storm00's user avatar
0 votes
1 answer
555 views

how to get the model's max x,y,z withing loading model by assimp

I want to split model space with octree to check intersection detection, so i need known model's max x,y,z and min xyz. to get the result,i traverse all meshes's vertex and compare them
user18330783's user avatar
2 votes
4 answers
297 views

How to return a tuple containing the smallest and largest numbers in the file

In this exercise, I need to write a function that take input a string representing a filename. The file contains a list of integers, one integer per line. Function should return a tuple containing the ...
Sandi's user avatar
  • 21

1 2
3
4 5
61