Skip to main content
Filter by
Sorted by
Tagged with
Best practices
0 votes
5 replies
91 views

I have an object db that has one field containing SKU's that correspond to another object that contains different venues. db.SKU = [1002,1005,1001,1008,1007]; I then have another object listing the ...
Powl_London's user avatar
9 votes
1 answer
152 views

Let's say I have a bunch of product strings that could vary slightly in format, e.g.: Super red Megaman T-shirt Super Megaman blue T-shirt Super black Megaman T-shirt Super Megaman T-shirt - ...
Stef Dawson's user avatar
0 votes
0 answers
42 views

I'm trying to understand how the reduce() function works in this example: const fruits = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple']; const count = fruits.reduce((tally, fruit) => { ...
heizzz's user avatar
  • 1
-3 votes
1 answer
102 views

I'm updating a tracking spreadsheet for a stock portfolio and would like to dynamically pull the holdings of the portfolio at specific time periods so that I can view the holdings at any point in time,...
Gimics's user avatar
  • 11
1 vote
2 answers
104 views

I'm working out of Scala for the Impatient (3rd Edition). (I'm not doing this for a class.). I'm trying to implement a factorial function using to and reduceLeft without a loop or recursion. This ...
Christopher Spears's user avatar
-3 votes
2 answers
69 views

I have this code: results = "[ { user_name: 'User 1', email: '[email protected]', userid: 'HJ10092', event_type: 'download', country: 'Venezuela', doc_type: 'mspowerpoint', ...
pickaxu's user avatar
  • 29
-3 votes
1 answer
83 views

I wrote the below code to solve a prep test, found online. The goal is to find the min absolute difference between numbers in an array. function minimumAbsoluteDifference(arr: number[]): number { /...
Igor Shmukler's user avatar
2 votes
0 answers
43 views

In the last example of Mark Harris' webinar I don't understand the indexing before the parallel reduction part. In "Reduction #6" the gridSize/number of dispatches was ceil[N (the size of ...
Michael Bay's user avatar
0 votes
0 answers
28 views

This is a similar question that was posted before but with a little expansion to the problem. The original post was this link: Create flatten dates sequence in Google Sheets in one column (without ...
Raven A's user avatar
3 votes
1 answer
89 views

When I try to reduce a large heap array with OpenMP reduction, it segment fault: #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { ...
LXYan's user avatar
  • 71
0 votes
1 answer
92 views

I am a a bit confused by some of the behavior of the of the inject (alias reduce) command in Ruby Background For any array, the second element (referenced after the accumulator) reflects the last ...
Ricman R's user avatar
-1 votes
2 answers
82 views

I have a 2d array which contains a list of series with title, rating, and time spent watching. For example: let seriesList = [["Squid Game", 3.5, "4 days"], ["Squid Game",...
amy's user avatar
  • 83
0 votes
2 answers
89 views

I want to importrange from Spreadsheet OLD with several tabs/sheets into Spreadsheet NEW. What i want to do is to import values from SheetA and Sheet B. First column: vstack(importrange(SheetA!A5:A),...
cywh's user avatar
  • 9
5 votes
3 answers
112 views

Javascript code: const bigArray2 = [ [1, 2, 3], [2, 4, 6], [3, 6, 9], ]; //creates single-layer array containing all elements of every array within bigArray2 const combinedArray = ...
Jake's user avatar
  • 51
2 votes
2 answers
67 views

I need to transform the following structure using React. export const bodyRows = [ { row: [{ cell: "Name" }, { cell: "Allan, Trent" }, { cell: "Smith, Nathan" }, { ...
RyRyWilli's user avatar
0 votes
1 answer
31 views

I'm trying to debug a problem in our production Kafka Streams app. The (simplified) topology looks something like this builder.stream("input").groupByKey().reduce( (agg, val) -> "...
Egor's user avatar
  • 1,660
3 votes
1 answer
313 views

Thrust has the thrust::reduce_by_key algorithm which works well for a problem of mine. I wanted to try to use CUB for finer control of memory and streams as well as interaction with my own kernels, ...
Treeman's user avatar
  • 116
2 votes
3 answers
335 views

Let's say we have a function that makes expensive calculation and an array of source values for which we do the calculation. We want to get a first return value of the function that is not falsy and ...
quadracik's user avatar
-2 votes
1 answer
234 views

I have a dataset as such, where there may be multiple testResults array elements, along with there being 1 or many response array elements; and I an wanting to extract all of the potential ...
physicsboy's user avatar
  • 6,466
0 votes
1 answer
136 views

I am trying to create a jq that is dynamic in returning data. User Story: I have data with many fields and not named like I want. I want to be able to based on the data and schema transform the data. ...
tmcc's user avatar
  • 1,020
0 votes
2 answers
141 views

I saw many post talk about use reduce to merge multiple dataframe. I try below code, it works with three dataframes, if it greater than three, tan, error reported: pandas.errors.MergeError: Passing '...
lucky1928's user avatar
  • 9,021
2 votes
0 answers
73 views

I have the following code snippet to combine a Seq of (DataFrame, BloomFilter) tuples. The DFs are in chronological order, and the goal is to union and deduplicate all the DFs while always selecting ...
Alex Guguchev's user avatar
0 votes
1 answer
86 views

I'm sure there is a better way to do this, but I do not know how to extract structure from Enum during reduce(). Assume ALL enums are identical in vector (but prob. solution needs to handle if this is ...
Igor Lautar's user avatar
0 votes
0 answers
91 views

I'm trying to use OpenMP with the following C++ code: double delta(10); const bool parallel = true; ... delta = 0; #pragma omp parallel for collapse(3) reduction(+:delta) if(parallel) for (unsigned ...
Elad's user avatar
  • 23
0 votes
3 answers
101 views

I cannot understand why I cannot reference the integer member of the nested class in the lambda. The following code demonstrates the failure. The same reference is used in the print prior to the ...
Tarthalion's user avatar
0 votes
1 answer
162 views

Hello fellow programmers. I'm new to the forum so please bear with me. What I am trying to achieve is taking a loaded image from file(e.g. background wallpaper image 4000x2250) and scale it down to ...
OS_Ninja's user avatar
1 vote
0 answers
67 views

Recently when I self-learnt MIT 6.5151 course, I first read CS 61AS Unit 0 as the preparation. Then I have read SICP 1 to 2.1 (with related lecture notes) as ps0 requires (also read 2.2.1 as CS 61A ...
An5Drama's user avatar
  • 774
2 votes
9 answers
506 views

I have an array of objcets. With reduce method after looping i want to receive two seperate arrays. Now, i am doing this way. const dogs = [ { weight: 22, curFood: 250, owners: ['Alice', 'Bob'] }, ...
Zuka Kharati's user avatar
0 votes
7 answers
134 views

Need to reduce an array of Objects to return the highest value of the same name. Need the following, [ { name: 'a', value: 20, ...(other object values) }, { ...
caiovisk's user avatar
  • 3,828
3 votes
2 answers
136 views

Here is an R example of using Reduce x <- c(1, 2, 2, 4, 10, 5, 5, 7) Reduce(\(a, b) if (tail(a, 1) != b) c(a, b) else a, x) # equivalent to `rle(x)$values` The code above is to sort out the ...
ThomasIsCoding's user avatar
0 votes
1 answer
37 views

I am using influxdb 2.7.6, and created a measurement called cgm_glucose_history. I added a tag called device_sn, a field called glucose, and a field called device_time to record the exact time when ...
李旭光's user avatar
4 votes
3 answers
121 views

I have a list of same-length vectors that I need to run different statistical functions on per vector element across the list. I know I can do this with apply by creating a data frame first and then ...
oepix's user avatar
  • 214
1 vote
2 answers
70 views

I want to reduce an array of objects like this: var data = [{ item: "Item 1", pages: 30, chapters: 3 }, { item: "Item 1", pages: 50, chapters: 3 ...
Ikzer's user avatar
  • 539
1 vote
2 answers
80 views

I have an invoicing summary and reporting spreadsheet and am trying to create a dynamic summary for each client (number of clients can change) where each invoice is listed per client, with a sum total ...
Duong Le's user avatar
0 votes
0 answers
58 views

I'm trying to write this recursion function that will pivot an array of object so I am trying to use generics. The code actually works perfectly, but I cannot figure out how to make typescript happy. ...
C5m7b4's user avatar
  • 108
0 votes
0 answers
56 views

I have an Angular app and I am getting the contents of a json file from Google Drive. The contents is an array of 1011 customers that I want to transform into an object. However the reduce function ...
Konstantinos Papakonstantinou's user avatar
2 votes
2 answers
496 views

i've got a quite complex situation to solve with google sheets. I already solved it in a very unelegant way, and I would need your help to understand why other solutions I tried failed, and maybe to ...
Francesco De Santis's user avatar
3 votes
5 answers
162 views

Why does the first reduce not work but the second does? The order of the comparisons should be the same... (reduce (fn [{:keys [minimum maximum]} new-number] {:minimum (if (and minimum (< ...
Antonio Smith's user avatar
0 votes
2 answers
87 views

The source file contains 17k to 20k rows. I'm struggling with the speed of calculating, the sheet is unresponsive for 60+ seconds. There are 14 executions of this function per sheet, and 6 sheets ...
Djisin's user avatar
  • 29
0 votes
0 answers
80 views

While running python map reducing code to calculate skewness and kurtosis values i am unable to get output: Code import os from mrjob.job import MRJob from scipy.stats import skew, kurtosis import ...
Suneel Kumar's user avatar
1 vote
1 answer
99 views

The current formula returns 2 columns and multiple rows. I want to store the result in a single "data cell" for future reference and post-processing. Is it possible to make sure that the ...
AlanSTACK's user avatar
  • 6,165
1 vote
1 answer
65 views

While going through and re-factoring some Java code I wrote a while back for Project-Euler. I ran into an issue with integer overflow where the answer was too large to contain in type int. This was ...
tijko's user avatar
  • 8,392
0 votes
0 answers
86 views

I have a sheet of tools that I have organized that I called "DATABASE" which is essentially just a list of my tools that are organized by their location and ID number: I also have a ...
J-Drake's user avatar
0 votes
1 answer
33 views

we are booking a training and we are trying to convert a description of what seats we have into a columnn list so we can automatically allocate our students to a class. Eg the the description of the ...
UKDataGeek's user avatar
  • 7,034
1 vote
1 answer
295 views

There is a sample of data table which consists of multiple header rows | | Song 1 | Song 2 | Song 3 | |---------------------------|----------------|----------------| |...
corry's user avatar
  • 1,549
0 votes
2 answers
51 views

How would you take an array such as this: arr1 = [[1150-500101-1000005530, 2750.0], [1150-500101-1000005530, 275.0], [1150-500101-1000008371, 825.0], [1150-500101-...
zuter's user avatar
  • 3
-1 votes
1 answer
188 views

I'm declaring the following array. let arr = [ { id:"aa", vals:[1,2,3] }, { id:"cc", vals:[3,4,5] }, { id:"bb", vals:[2,3,4] }]; Printing it in the console ...
Konrad Viltersten's user avatar
-4 votes
1 answer
68 views

I have an array like that const arr = [ [1, 0], [0, 2], [0, 1], [0, 1] ] I want to reduce it and get a new array. My aim is getting values of nested array by index. [[index(0)],[index(1)] const new ...
nihat onal's user avatar
1 vote
0 answers
345 views

I am struggling with tca 'BindingReducer' and 'onChangeOf'. I want to bind childState from ParentState, especially 'subset of the childState' changes. Maybe there are several solutions, but i think '...
e A's user avatar
  • 21
0 votes
2 answers
430 views

Is it possible to have two accumulators with the reduce method? I need to pass another const inside my reduce. I want to do the same as const one with const two. Do I have to create a new method or ...
user avatar

1
2 3 4 5
89