567 questions
5
votes
1
answer
110
views
Most performant approach to find closest match from unordered collection
I'm wondering what the best approach for finding the closest match to a given value from a collection of items is. The most important part is the lookup time relative to the input size, the data can ...
0
votes
0
answers
37
views
Group lists using DOM manipulation
I'm trying to organize market lists by metro regions but I'm running into issues retrieving elements by their ID. Specifically, I'm encountering a TypeError: Cannot read properties of null (reading '...
1
vote
1
answer
48
views
Max value based on criteria among two joint tables in Access
I have two tables in access with different dates for one and the same order ID. In first one I have only one record per order with date. In the second one I have multiple records per order with ...
-3
votes
2
answers
81
views
Formula to find the nearest match
I need a formula to cell G2 to find the nearest match based on cell E2 and F2.
My desired result would be Working Offline, since range A2:A13 = E2 (Agent 1) and C2:C13 = F2 (10:00:00), the status ...
0
votes
1
answer
180
views
Find closest point from array
I try make table using array for example table like this
int array[5][3] = { {A, 200, 400}, {B, 300, 600}, {C, 100, 200}, {D, 200, 100}, {E, 200, 400} };
so array output will be like this :
| id | X ...
0
votes
2
answers
378
views
How to prevent click outside event from closing a filter component when interacting with a calendar component in Angular?
I'm working on an Angular application where I have a filter component that toggles its visibility based on a click outside event. This works as expected, but I have an issue when there is a calendar ...
1
vote
1
answer
109
views
Find the distinct closest date match for each record from 2 tables
Suppose I have Table1 and Table2 with the below data. I want to find the next closest Date match for Table 1(JoiningDt) that is available in Table2.ClosestDt for each ID. Note: Closest Match from ...
2
votes
1
answer
97
views
Find the diameter bin that contains 50% of the total particles
I'm trying to find the diameter at 50% of the total particles. So I was able to use this code to find the diameter size at 50% of the total particles. So the first column is the diameter size, the ...
0
votes
2
answers
61
views
To find records from Table A having effective dates closest to records in table B
I have two tables as below:
Table A:
ID
Age
Dept
Salary
Start_date
1
30
A
$1000
01-01-2000
1
31
B
$1200
01-01-2022
2
25
C
$1200
01-06-2021
2
26
A
$1300
01-01-2022
3
34
D
$1400
01-01-2021
3
35
C
$1800
...
1
vote
0
answers
45
views
Largest number closest to Y
I have two integers "X" and "Y" where X > Y, I want to find a closest larger number to Y, which is obtained by deleting zero or more digits from X, by keeping the order of ...
0
votes
0
answers
41
views
Match lists based on the closest value [duplicate]
I have two lists:
a = [35, 400, 200]
b = [100, 32]
I want to match each value in ‘b’ with the closest value in ‘a’. Each value in ‘b’ can have at most one match. The final list contains values that ...
0
votes
2
answers
63
views
Check with Javascript or jquery if the parent div of a div contains a specific class name
I have a text in a set of divs. If somebody clicks on that text I have to know if the 4th parent div with the class "div1" holds the class name "exampleclass".
My HTML:
<div ...
0
votes
0
answers
256
views
vuejs click event triggers twice
**e.target.closest event triggering twice**
*I am using vuetify framework in my vuejs code.. on clicking v-card(overall), i want the page to redirect to another page, except on ...
0
votes
1
answer
28
views
jquery closest bug for same class
ul alt2 should be aaa3 but becomes aaa0 why?
$(" .item").each(function(e){
tt=$(this);
tt.attr("alt",e);
$(this).closest('.item').attr('alt2', 'aaa'+$(this).attr('alt') );
})
<script ...
0
votes
0
answers
79
views
Get closest number to object key value in array in JavaScript
I have an array of objects, and I'd like to find the closest number to a specific key value. I've seen other answers that show how to do it for an array full of numbers, but I can't figure out the ...
1
vote
0
answers
92
views
Inconsistent results when matching closest lat/long points in r using sf and st_distance()
I have a large dataset where each row is a station. I need to find the closest station within each year but where a different type of equipment was used. I then want to either combine these rows into ...
0
votes
1
answer
190
views
I want to use "once per bar" feature in Strategy inputs as in Indicator. What should I do?
I want to use "once per bar" feature in Strategy inputs as in Indicator. What should I do?
I want the strategy to be traded immediately as in the indicator without waiting for the candle to ...
-1
votes
2
answers
53
views
Display text in the closest element with certain class
I'm trying to display a text in the closest element with the .msg class, but it always displayed in the first element with .msg class.
let btn = document.querySelectorAll('button');
btn.forEach(...
0
votes
1
answer
1k
views
Find closest values in dataframe column based on values in column in another dataframe pandas
I have two dataframes, one with a "full" time series and another with far fewer elements representing special points in time for an experiment with many trials. The time variable runs from 0 ...
0
votes
2
answers
68
views
get closest number out of array in array in javascript
I know this is a bit on nonsense but I need to get the closest number out of 2 arrays or:
const myarr = [[12, 42], [12, 56], [30, 54]]
console.log(colsest_out_of_closest(myarr, [12, 50]))
-1
votes
1
answer
406
views
Find closest element in list for each row in Pandas DataFrame column
I have a Pandas DataFrame and comparation list like this:
In [21]: df
Out[21]:
Results
0 90
1 80
2 70
3 60
4 50
5 40
6 30
7 20
8 10
In [23]: ...
1
vote
5
answers
680
views
Finding the closest value in a vector, for each value in the same vector, excluding the element in question in R?
I am trying to find a way to find the closest value in a vector, from elements in the SAME vector, but excluding the row in question. For example, suppose I have dataframe A with one column (column_1):...
1
vote
1
answer
481
views
Find the closest value of each value in a column compared to another column in the same PySpark dataframe with exclusion criteria
I have two pyspark dataframes like shown below:
dfamr = spark.read.csv("/C:/Sushant Workspace/Tech/Self/pyspark
datasets/amrrates.csv", header="true")
dfexclusion = spark.read.csv(...
0
votes
2
answers
133
views
How do I get a time delta that is closest to 0 days?
I have the following dataframe:
gp_columns = {
'name': ['companyA', 'companyB'],
'firm_ID' : [1, 2],
'timestamp_one' : ['2016-04-01', '2017-09-01']
}
fund_columns = {
'firm_ID': [1, 1, 2, 2, 2],
...
1
vote
1
answer
100
views
Find the closest value of each value in a column compared to another column in the same PySpark dataframe
We have a PySpark dataframe containing rate codes that we have to use to give discounted offers to our customers.
-ratecode - Actual rate code
-weeklyrate - weekly dollar amount that the customer ...
1
vote
1
answer
123
views
Get the closest currency rate
I would like to join two dataframes based on currency rate exchange and date from the second dataframe. I have tried the approach cited here, but the datediff gives the difference in dates so it doesn'...
0
votes
2
answers
417
views
How to find the value of input field using jquery .closest() method when checkbox is checked?
This code is giving me undefined value when I try to show the value through alert message.
<div>
<input type="checkbox">
<div class="aid_closest">
&...
0
votes
1
answer
388
views
How to find closest value match between 2 data frames in R
Problem: I have 2 datasets with no matching identifiers (like ID) and need to find the closest match in df1$time to df2$tstart. df1 (with time column) has 660,000 rows with time stamps approximately ...
0
votes
1
answer
75
views
CSS / SCSS - Closest Value To
Maybe it's a dumb question, but there is a way to get closest value to target?
Something as writing
closest(58px, 6.4vh, 2vw)
and between 6.4vh and 2vw retrieve the closest to 58px
1
vote
1
answer
157
views
Find n-1 closest values based on criteria in a dataframe in R
I have a df with data from a qPCR run:
df_1 <- structure(list(
row = c("A", "A", "A", "A", "B", "B"),
column = c(17L, 18L, 19L, 20L, ...
1
vote
1
answer
709
views
Get closest ancestor by partial class with JS
I need to get the closest ancestor by class, byt I need to use a partial class. For instance:
<div class="parent-1">
<div class="child"></div>
</div>
I'...
0
votes
0
answers
49
views
How to close a jquery dialog from inside the open function?
I want to open this dot_card.php page in a dialog box. I want to interrupt the the form submission to do some stuff and them do an ajax call. After the form is submitted via ajax, I want to close ...
2
votes
1
answer
1k
views
Python: finding the closest value in a list less than or greater than a input value, excluding the input value itself
Is there a way to find the closest value from a list that is either less than or greater than a value gathered by input? The input value has to be excluded from the possible values.
I've used this, ...
1
vote
1
answer
342
views
jquery how to check near element with certain class exist?
I have two element inside <tr>:
<table>
<tbody>
<tr>
<td><input type="text" class="form-control input-state" onclick="myfunction(this)"...
1
vote
1
answer
513
views
R - Obtain the closest smaller and bigger values compared to a reference value
Is there an elegant way to obtain the closest smaller and bigger values compared to some reference value? Following example should clarify my goal:
set.seed(42)
df_Date <- data.frame(Date = seq(...
0
votes
2
answers
825
views
Get two closest values to one in array (smaller and higher) javascript
this is my point
x=3;
array =[4,8,7,5,6,9];
if would like to know if there is a value in array equal to x, and, if there isn't, find the two closest values in the left and in the right, in that case ...
-1
votes
1
answer
173
views
javascript or jquery find nextSibling
I have a shopping cart view
cart list count
and this document
<div class="input-group input-number-group">
<div class="input-group-button" onclick="decrement_cart(...
1
vote
2
answers
2k
views
Finding the closest point from Point Cloud Data to point (0,0,0)
I made a program to plot a figure from point cloud data (x,y,z coordinates shown as list x_list, y_list, z_list). Now, I have to find the closest point to (0,0,0). Anybody has an idea to do that? Here ...
0
votes
0
answers
30
views
Given an arbitrary RGB/HSV Value, Output Nearest Defined Color [duplicate]
Say, Given an arbitrary RGB Value and an array of colors with defined values(eg red, blue, green, yellow, etc.), what would be an optimal way of finding the nearest defined color to the arbitrary ...
4
votes
2
answers
796
views
Merge two dataframes by a closest value in R
I have two dataframes that I want to merge by the closest value in one column. The first dataframe (DF1) consists of individuals and their estimated individual risk ("risk"):
DF1<- data....
0
votes
0
answers
109
views
In 3d, how to pick the most suitable point?
I have a 3d scene (with pointclouds and some other objects). I implemented algorithm to pick the closest point to the mouse for a pointclouds. But my problem is : I have several objects in my scene, ...
0
votes
1
answer
335
views
Jquery: append creates multiple new elements in elements before when clicked
I'm creating a personal use website where I want to add "modules" or groups in which I can add links.
The problem I'm facing is when I add a group and start adding links, it all works fine. ...
2
votes
4
answers
1k
views
How to detect the closest value below and above a given reference variable in a data frame in R?
Consider the following random MWE.
For every row, I am trying to determine which variable has the closest value below the constant reference_day and which variable has the closest value above the ...
-1
votes
1
answer
91
views
How to use Getclosest() in a list in Python
I have code which is taking RA and DEC values (some coordinates in str form) from a text file and using astroquery to query objects respect to those RA and DEC data and shows a table for those objects ...
0
votes
2
answers
1k
views
TestDome Challenge Closest Relative
I'm tried to solve this challenge from testdome and i got stuck.
The following HTML represents a family tree:
<James>
<Dave></Dave>
<Mike></Mike>
<Sarah></...
2
votes
0
answers
94
views
Can't get correct element with .closest()
In my app, I'm trying to add an active class to the proper section, and the logic is based on the .closest() method.
When I click on Span 2 I need to get the section with .--level-2, I can get the ...
0
votes
0
answers
483
views
Closest pairs of elements in two sorted arrays
We are looking for an efficient algorithm to solve the following problem:
Given two increasingly sorted arrays.
Find the closest corresponding elements in each array that difference is
below a user ...
3
votes
2
answers
1k
views
Finding the closest number in a Binary Tree to a given target
I have a very simple Binary Tree
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
root = TreeNode(8)
root.left = TreeNode(5)
...
0
votes
1
answer
693
views
How to find closest words in a string in Python
I am scraping the text of a long document with the same ticker repeated multiple times throughout. I am trying to locate a specific ticker that is closest to another word (let's call it a base word. ...
1
vote
1
answer
62
views
Inject HTML using jQuery closest() and Ajax
I have a list in which each item can display its content by injecting it with Ajax.
(function($) {
$(document).ready(function() {
$('.show-content').click(function() {
...