Questions tagged [min]
Minimum value. Smallest, tiniest, least.
3,020
questions
0
votes
1
answer
24
views
MIN() in JOIN based of dates
I would like to join two tables based on two common fields. Assume the date is 2024 I want to join the sale table on dictionary table which hold only articles with dates 2022 and 2023. Because of the ...
-2
votes
2
answers
80
views
`min()` is not working properly in Python?
I am new to Python and notice the following error when using min().
import pandas as pd
a = [1,2,3,4,5]
print(min(20, pd.array(a)**2))
The code should return[1, 4, 9, 16, 20], however, it returns [1, ...
1
vote
3
answers
59
views
Min dates from group by postgresql
I have table with data:
create table measure_app_scalemeasurement (
store_code text,
certificate_id text,
audit_ending date);
insert into measure_app_scalemeasurement values
('K010','vwv', '10....
0
votes
1
answer
56
views
Find the maximum and minimum values in a column? The values are percentages
I need to script a function to pull the minimum and maximum values from one column. The values are percentages so I'm not sure if that will trip up the function since it's not an integer?
I tried
...
0
votes
2
answers
97
views
Why it is giving some random output if se(smallest element) == sse(second smallest element)? [closed]
vector<int> minAnd2ndMin(int a[], int n) {
int se = a[0];
int sse = INT_MAX;
for(int i=1;i<n;i++){
if(a[i]<se){
sse=se;
se=a[i];
}
...
1
vote
2
answers
47
views
How do I get the minimum value of one column base on conditions met from other columns in Excel?
I have Table A and I want to create two new columns to get table B. I am trying to create a formula where I am only calculating the min or max of previous records for each person. Is there a formula ...
-1
votes
0
answers
18
views
Find the minimum and maximum value and their position
USE [college]
GO
/****** Object: StoredProcedure [dbo].[Customer] Script Date: 11/16/2023 10:35:50 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[Customer] @...
0
votes
3
answers
84
views
Filter database based on max and min that varies each year
I have a database that looks like this:
Year ID Date Occupy
2010 1 10 Yes
2010 2 11 No
2010 3 12 Yes
2010 4 9 No
2010 5 15 No
2011 7 7 Yes
2011 8 9 ...
0
votes
1
answer
46
views
Using MIN function with 2 match/index functions
Used this INDEX/MATCH/MAX function to get correct output for the following table
=INDEX($B$2:$B$10000,MATCH(MAX(INDEX(($A$2:$A$10000=$F1)*$D$2:$D$10000,)),INDEX(($A$2:$A$10000=$F1)*$E$2:$D$10000,),0))
...
0
votes
0
answers
18
views
using Number as mask, iMask automatically modifies the input when field is blurred
const opts = {
lazy: true,
autofix: false,
min:100 ,
max:9999999,
mask: Number,
thousandsSeparator: ' ',
scale: 0,
}
}
With the above setup, if I enter 50 and then focus on another input, the ...
0
votes
1
answer
38
views
How to slice local minima and maxima in a list till last item, without using numpy
I want to search for local maxima and minima through a series of iterations until the list has only one element remaining. Then that last element is the 'winner'. The list contains pairs of player ...
0
votes
2
answers
28
views
min and max values displayed are different from those actually stored in a terra raster
When and why do terra rasters sometimes display min and max values different from those actually stored in the raster?
# create a 10x10 binary raster with values 0 or 10:
r <- rast(nrows=10, ...
0
votes
0
answers
46
views
Identify peaks without a priori knowledge of curve shape?
I have a dataset with a profile that change over time. It seems to always be roughly Gaussian in shape, but the way the Gaussian "points" (whether the Gaussian rises then falls, or falls ...
0
votes
1
answer
22
views
How to extract entire row of max and min using proc function in SAS?
I have to identify which sneaker (variable 1) is matched (same row) with the highest and lowest sales (variable 2) by using a SAS procedure function.
Current code:
PROC MEANS DATA = M4.sneaker min max;...
0
votes
0
answers
24
views
why the variable C is needed to get the right output of index?
I'm new to study the Python.
Now I'm trying to find the min in the list.
I'd like to know the reason of the variable C.
I tried to get a result without C and I could get the right min but not for the ...
0
votes
1
answer
8
views
How to get all the tuple pairs in a list with the min value among the first element
The output would only be the first instance in the list, whereas I want to have both instances of [(1,'a'),(1,'b')]
smallest_teams = []
roster = [(1,'a'),(1,'b'),(3,'c')]
smallest_teams = list(min(...
0
votes
0
answers
25
views
Deleting the lowest CARD# for customers with more than one CARD# of that type
I have a customer table and I need to delete the lowest card number for a specific card number for customers who have more than one card number of that type stored. I can write a select query for it ...
3
votes
1
answer
93
views
Calculate rowwise Min/Max across a variable range of columns in R
For a data analysis in R I am trying to calculate a variable A1, which is the minimum value across a range of values. The tricky thing is that the start of the range varies depending on the index of a ...
0
votes
1
answer
19
views
redshift sql row selection based on min date
I need to extract all rows from a large data set with 30+ columnns based on the min time date, account can repeat across days and execution dates, execution id is distinct and can be thought of as a ...
0
votes
2
answers
40
views
Having trouble using MIN() in having clause
Trying to select earliest order_date for each customer_id.
Using following query
SELECT customer_id, order_date
FROM Delivery
GROUP BY customer_id
HAVING MIN(order_date) = order_date
But ...
0
votes
1
answer
28
views
Finding the lowest value from list
I have a table "songs" which is like this
Artist
Title
Pos
Date
artist1
title1
1
01-jan-1980
artist2
title0
9
01-jan-1980
artist3
title2
3
01-jan-1980
artist1
title1
1
07-jan-1980
...
2
votes
2
answers
36
views
Integrating over a min() function gives different result than the function inside
Shouldn't these two results be the same? Why are they not?
integrate(\(x) {x * min(-x+10, 10)},lower = 0, upper = 10)$value
> [1] 1.085709
integrate(\(x) {x * (-x+10)},lower = 0, upper = 10)$value
...
-1
votes
1
answer
55
views
How to use min() and max() functions to print the variable name instead of the value? [duplicate]
This is my code for bot-card game.
card_5 = 3 #all variable names
card_6 = 4
card_7 = 5
card_8 = 6
player_card_list = [card_5,card_6,card_7,card_8]#list of variables
min_player_card = int(min(...
0
votes
1
answer
41
views
How to get small and big value from an array using for of loop javascript? [duplicate]
How to get small and big value from an array using for of loop javascript?
From the code, I able to update the small value. But I am not able update the big value.
const arr = '2 3 1 1 8'.split(" "...
0
votes
3
answers
82
views
How to select earliest date with condition
Is it possible to select the earliest Open_Date from the below table on the condition that Sub_ID's Status is either Open or Complete?
Order_ID
Sub_ID
Open_Date
Close_Date
Status
Status_Update_Date
...
0
votes
1
answer
39
views
MAX amd MIN events by hour between two dates
I have a transactional table with the transaction's timestamp and other columns, like this.
transaction_timestamp | column_1 | column_2....
--------------------------------------------------
2023-01-...
1
vote
1
answer
37
views
How to find max and min values in different groups in Excel data using R
I am new to R, but need to write a code to find the max and min values on each date, and then have it create new columns that give the max/min values and which hour of the day they are associated with....
0
votes
1
answer
85
views
Getting the maximum / minimum value of a shifting sequence
I'm looking for the most efficient way to compute the maximum / minimum value of a shifting sequence in Python.
By a shifting sequence I mean a data structure like the collections.deque. However the ...
0
votes
2
answers
46
views
Display the maximum and the minimum of a row of numbers the ending signal is a 0
I've found a French exercise online. This is a translation of the wording:
Write a program to display the maximum and the minimum of a row of integers (the row is one or more inputs by the user). The ...
0
votes
1
answer
109
views
css min() and max() functions vs min-width and max-width
I've seen people using min() and max() css functions instead max-width or min-width props like that:
width: min(440px, 100%);
Instead of classic:
width: 440px;
max-width: 100%;
Which is better? I ...
1
vote
1
answer
28
views
highcharts xAxis min not works in unvenly spaced xAxis data
in code i provided i have a data series column with unevenly spaced data,
and set min value for xAxis with 1658086242000, but after seeing chart i saw 2 value that is before my min point, why is that?!...
0
votes
0
answers
6
views
Script to automatically assign max/min right Vaxis values from cells
I have successfully added a script to assign vaxis max and min values from cells in my sheet. However, I need to do the same with the RIGHT vaxis. (the current script assigns to the left). How can ...
0
votes
4
answers
45
views
Rowwise column name of minimum value in certain columns excluding NAs
I have a dataset that looks like this:
library(dplyr)
Data <- tibble(Code = letters[1:6],
Min_0 = c(12.3, NA, 1.1, NA, 0, NA),
Min_1 = c(3.6, NA, 12.4, 1.7, 15.6, NA),
...
2
votes
3
answers
41
views
Calculate min() and max() of each matrix column
I'm using the following matrix:
dput(data) =
structure(c(269.643848985434, 284.856715574861, 278.687093704939,
242.00628682971, 258.754844814539, 257.241126745939, 250.868861973286,
267.881099879742,...
1
vote
2
answers
137
views
Finding the minimum value across columns by group and when a condition is met
I am trying to find the minimum value across two columns for each person in my data. I only want to consider values in one column for the minimum calculation IF a condition (in another column) is met. ...
-1
votes
1
answer
50
views
Why do I get "None" as output for a function? Also, how to make a function run for both strings and numbers?
The question is :
Write a function called merge that takes two already sorted lists of possibly different lengths, and merges them into a single sorted list, without using the inbuilt sort function
...
0
votes
1
answer
58
views
How to sort a list using min() function? [duplicate]
The question is :
Write a function called merge that takes two already sorted lists of
possibly different lengths, and merges them into a single sorted list.
(a) Do this without using the sort method
...
0
votes
2
answers
42
views
MYSQL Min Max Historic Values
I have a MYSQL table with this format:
Insurance Date Value
A 2020-01-01 2
A 2020-02-01 5
A 2020-03-01 4
A 2020-04-01 6
A 2020-05-01 8
A 2020-06-01 1
A 2020-07-01 3
A 2020-08-01 7
A 2020-09-01 9
A ...
1
vote
1
answer
94
views
CSS grid column min of max-content and a fixed width
I have a css grid for which I would like the column widths to be either the width of the largest item in that column or 100px, whichever is smaller. I thought minmax(max-content, 100px) might work but ...
-4
votes
2
answers
111
views
What happens on a tie on minBy / maxBy functions?
If you run a minBy or maxBy from the kotlin-stdlib on a collection with two objects and there's a tie for the lowest / highest value, which one will the function return?
0
votes
1
answer
25
views
Python How to locate a value in a different column based off two other columns
I have a data set that has 4 columns in it. One with random numbers, one with 1s and 0s, another that breaks it into segments and one that sees if the value is different than the one before it.
Ex ...
0
votes
1
answer
36
views
MySql query tuning for min/max dates by group
I have a table with several million rows of data. I have a primary key on id, and a compound unique key on col2, col3, col4 and my_date.
Sample data is shown here...
id col2 col3 col4 my_date
1 1 ...
1
vote
2
answers
74
views
why is my min function printing multiple values, shouldn't it print only one?
the problem I'm having is trying to get my min() function to print only the lowest values and then print the nested list that contains that lowest value. I know that min() should only produce one ...
0
votes
2
answers
80
views
Problem with custom written compare function
could someone have a quick look at my code because i just can't find out why i am not getting the result i want. The goal here is to find largest and the smallest number from an array that i gave to ...
0
votes
0
answers
16
views
Determine values higher than twice minimum value in a list
I have a large list with price data per 15 minutes over a whole year (total 35140 entries) (name list: p_avg_15). For the data, I need to determine per full week which entries have a price higher than ...
1
vote
1
answer
33
views
Create rolling minimum of groupby in R [duplicate]
I have an R - dataframe with the following format:
id
date
value
1618
01/01/23
10
1618
02/01/23
10
1618
03/01/23
6
1618
04/01/23
8
1618
05/01/23
10
1618
06/01/23
4
3512
01/01/23
1
3512
02/01/...
1
vote
1
answer
48
views
PostgresSQL- find 3 lowest values based on another column [duplicate]
I am challenging this issue. I have a table that calls: results. There are 3 columns and it looks like below (id column is int, city is varchar, score is int):
id name score
1 x 5
2 x ...
-2
votes
1
answer
109
views
Finding the minimum and maximum populations
This is my code. When I try and get the minimum and the maximum populated country's to be returned it prints the first country from the csv file for both the maximum and minimum populated country.
...
0
votes
0
answers
25
views
How to find max and min values based on the median and 95%CI from a summary table?
I'm trying to plot a boxplot of median survival times and their 95%CI, since my KM curve is too busy. geom_boxplot() requires a min and max values. How to calculate these off the median and CI?
Side ...
2
votes
2
answers
1k
views
Minimize array elements by multiplying adjacent elements only if the product is less than equal to k
I recently came across this question in an online assessment.
arr = [2,6,2,4]
k = 15
The array elements need to be minimized by multiplying two adjacent elements only and only if their product is ...