Skip to main content

Questions tagged [iteration]

Iterations are the successive repetitions in loops such as for, foreach or while. Questions with this tag are often concerned about how to best handle a collection of data.

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

How use each in cypress when element is detached from DOM after action [duplicate]

I have this cypress code and it works. I need to iterate through all the links on the page. After clicking on each link, a breadcrumb tab opens. After closing the tab, the page with the links returns. ...
randomWeirdo's user avatar
-1 votes
1 answer
51 views

Javascript : Find node value through recursive iteration

I have the following structure : var content = { "id": "RkktMTA1OC0wNTE3QElNQi82NTAwNC9YLzAwSDc", "name": "FI-1058-0517", "category": &...
BlackPage's user avatar
  • 103
0 votes
1 answer
24 views

Iterate through all the days in a month in DJANGO template

enter image description here I have a model table like above which contains two columns on which dates on which an item is being sold in a month. I want to show the entire month table in Django ...
JTO  IT  CDR 's user avatar
0 votes
0 answers
9 views

How to extract particular field from custom duplicate objects and build a another response list using java 8 streams

I have below response from database and I need to convert it into the final json format using java 8 streams. Response from Database: [ { "name": "Test1", "age": "33&...
user26037047's user avatar
-4 votes
1 answer
62 views

Python Apply function to create new rows in loop

Goal: Here is a sample of a dataset that has "ID", "PHASENAME", "CDAYS", "MULTI_FACTOR", "DAY_COUNTER", and "DAILY_LABOR_PERCENT". The goal ...
Ty Kendall's user avatar
0 votes
1 answer
39 views

Not able to get iteration in curly codes or php correctly

I have uploaded images as follows: image 1 (an image is uploaded) image 2 (no image is uploaded) image 3 (an image is uploaded) image 4 (no image is uploaded) image 5 ...
Meng888's user avatar
  • 31
-2 votes
0 answers
22 views

Object Not Updating Inside FOR Loop [duplicate]

Can someone please explain why this object is not being updated? This has been annoying me for more than an hour. When I run the code on this website: https://playcode.io/1919282, the fillcolor is the ...
Zackattack's user avatar
0 votes
1 answer
44 views

Azure DevOps Rest API - Creating Iteration don't work

First I call all iterations that I have in my project - and it works fine and then I want to create a new one via the API. , but the method doesn't work, I get the error: The remote server returned ...
askldq's user avatar
  • 13
0 votes
1 answer
82 views

My C code is able to iterate once through and come up with the correct mileage but on the second iteration it fails

The problems objective is to write a program that takes a number of data sets the user would like to enter and then within the data sets it counts how many miles you traveled. For example for the ...
Maxwell Scharkopf's user avatar
0 votes
5 answers
128 views

Variable number of nested array iterations in C

First, sorry if the title is not clear, but I don't know how to ask this properly. Imagine I have an array of N elements, in this case 4: #define ELEMENT_COUNT 4 int arr[ELEMENT_COUNT] = { 'a', 'b', '...
trxgnyp1's user avatar
  • 412
0 votes
0 answers
26 views

Execution is very slow for GAN

I wrote a code on GAN and had previously trained in the Colab environment. I leave the Colab code below. def build_generator(latent_dim): """Build the generator model.""&...
Muhammed Gülsoy's user avatar
2 votes
3 answers
106 views

How to iterate over multiple ranges / sequences / numbers specified in var?

I can iterate over multiple ranges / sequences / numbers with constructions like: for i in $(seq 1 3) 5 $(seq 7 9) 11; do echo $i; done for i in {1..3} 5 {7..9} 11; do echo $i; done But how to ...
Anton Samokat's user avatar
1 vote
3 answers
73 views

How to iterate through a dictionary to get values on the lowest level?

Please help me understand how to extract the value of each ingredient for each product and do something with it. But for starters I just want to print them all one by one. MENU = { "product_1&...
Genkuru's user avatar
  • 21
0 votes
0 answers
28 views

Problem with double-mesh and error estimation

I am writing a Matlab code for a first-order nonlinear singularly perturbed parameterized problem with integral boundary condition. I have successfully achieved the desired order of convergence for ...
Shashikant Maurya's user avatar
-1 votes
3 answers
60 views

Formula to iterate the input range and stack the results into a column

Demonstration of what the result should look like: I need a formula in Google Sheets that iterates each input from input range, the look-up results for every single input will be stacked into a ...
user23576324's user avatar
0 votes
0 answers
61 views

Loop over grouped data in R

I have two dataframes, one where id is a primary identifier and the other is long data. I merged both and so I have long data (this can be reversed). I grouped the data based on id and want to loop ...
blessingAlabi's user avatar
0 votes
0 answers
24 views

Efficient method for sharding BigQuery table collection

I would like to ask for advice regarding the following task: assume a collection of BQ tables bearing names with structure name_YYYYMM and containing each a DATETIME type column called date_time whose ...
ΑΘΩ's user avatar
  • 111
0 votes
2 answers
38 views

How to validate JSON response using JSON test data file?

Having JSON response with nested elements. I would like to validate it against JSON test data using Postman and test functions. For the moment I can easily reach it by hardcoding: const jsonData = pm....
Thomas's user avatar
  • 1
0 votes
2 answers
36 views

how do i create and append to a new dataframe utilizing a iteration loop to extract of data?

i want to have a basic direct method to use different criteria to form new dataframes which i will display in a simple pie chart. i have such a feeble grasp of the topic that it seems to be difficult ...
tooDeeStoned's user avatar
0 votes
1 answer
34 views

What is the best way to have different entry points for a list of iterative commands?

I have a list of iterative Python commands: def command_list(start_at): step1 step2 step3 # ... stepN Now I want to start_at different steps in this list of commands and then ...
Sur3's user avatar
  • 31
2 votes
1 answer
70 views

Tidying data frame with multiple variables within multiple columns

I'm working with a "molten" data frame, though perhaps "volcano" is a more apt description of it. Basically, there are two columns in this data frame that break the first rule of ...
johnny_gillette's user avatar
1 vote
2 answers
43 views

Check if greatest rolling change is less than a specific number in dataframe

I have a dataframe of a time series of stock prices and need to see at any point in time if the change (whether it be pct_change(1), pct_change(2), ... , pct_change(7) is less than 20%). The logic I ...
Anonymous's user avatar
0 votes
0 answers
18 views

How to load multiple .mat files with different suffix once I selected a starting file?

I have the following problem which I do not know how to approach: I have a folder with four .mat files like this: LeCroy000_000_ch1.mat LeCroy000_000_ch2.mat LeCroy000_001_ch1.mat LeCroy000_001_ch2....
i33SoDA's user avatar
  • 75
1 vote
1 answer
51 views

Netlogo: efficient iteration using 'foreach'

I want to calculate and store two certain quantities associated with turtles' properties, namely count how many turtles meet a condition and the sum of these turtles' specific attribute. That specific ...
G. Papad.'s user avatar
0 votes
3 answers
90 views

I have a query to generate sequence of dates based on a given start date. I want to run the same query for all other dates and union the results

I have table1 with startdates in a column 10/02/2023 StartDate 04/02/2023 15/03/2023 I have around 500 values in this table. I need an extra column which will generates by adding a month to the ...
Prashanth Nag's user avatar
1 vote
1 answer
95 views

Improving performance of iteration in R

I originally created a for loop to calculate numerous variables that were sometimes dependent on previous iterations e.g. [i] and [i-1]. To improve the performance for larger datasets I attempted to ...
mrob27's user avatar
  • 73
0 votes
0 answers
29 views

Mongodb iterative methods inside aggregate pipeline

Hi so I am working on a database and we have 100k entries where the structure looks similar to dict = { 'testResults': { 'test_1':1, #1 or 0 if a test passed/failed ...
SC990987's user avatar
1 vote
2 answers
63 views

Iterate along the two vectors of different length using map()

I have two vectors of unequal length. One vector is a list of dataframes and the other vector is made up of unique values. How can I use map() to iterate the vectors over a custom function? Dummy data ...
William's user avatar
  • 360
-1 votes
1 answer
83 views

C# - WPF - Display list of strings

When I search the equivalent of foreach in xaml WPF, I get ItemControl tutorials, but it is only about presentation it does not solve the iteration part of it how do I do this in WPF ??? <TextBox ...
pf12345678910's user avatar
0 votes
1 answer
30 views

Space Optimization for Iterative Depth-First-Search (DFS)

Problem In most academic literature, the preferred DFS algorithm is always recursive, however, for large Graphs, an iterative variation using a Stack seems much more practical to me, without running ...
Michel H's user avatar
  • 343
0 votes
1 answer
29 views

compilation process in some java question about relate to 2d arrays

public static boolean ContainedArr(boolean[][] photo, boolean[][] sub) { //find if sub is sub array in photo if (sub.length>photo.length ||sub[0].length>photo[0].length) { //sub bigger ...
Itamar B-E's user avatar
2 votes
3 answers
76 views

Is there a way to make combinations of paste0 function with a list?

I have a vector of names: names <- c("a", "b", "c", "d", "e", "f", "g", "h") I want to make series of combinations ...
Alireza Sadeghi's user avatar
0 votes
0 answers
22 views

Is there a reason that Python allows indexing the class list itself? [duplicate]

I have come across a "feature" of Python that allows one to index the list class (and all classes that implement __getitem__() AFAIK). It took me a non-trivial amount of time to uncover that ...
Epanemu's user avatar
  • 118
0 votes
0 answers
21 views

When combining iteration and recursion, how do I express the recursion via tail calls?

I am working on a practice problem and I have found a recursive solution. However, I can't figure out how to express the solution as tail recursion. I think that the issue that I am having can be ...
David Moneysmith's user avatar
3 votes
0 answers
54 views

Python: Iterating through 2 lists

I am trying to implement the following equation: Where zc is an equally spaced range of values e.g. t_array = np.arange(z_[0],z_[-1],0.01) In this case z_[0] = -15.336 z_[-1] = 15.336 I'm struggling ...
Justincomp's user avatar
2 votes
2 answers
50 views

Substituting number of simulations (n) in rnorm() using a list of predetermined values

I'm using rnorm() but instead of substituting the number of simulations n with just one variable, I would like to do this multiple times with n having predetermined values from a series of values. (...
Arvin's user avatar
  • 35
0 votes
0 answers
46 views

Iterating a Landsat image collection to display as a layer in google earth engine

I am working with Landsat 8/9 in Google Earth Engine (GEE) and would like some help. I have a list of Landsat images and want to do dNBR calculations to each of them and later displaying each as a ...
TURTLE's user avatar
  • 1
-1 votes
1 answer
36 views

LibreOffice Calc - Check if event date is in period of time and return event attribute

In spreadsheet like this: A B C D E 1 Shift start Shift end Sum of event durations on that shift (min) 2 01.03.2024 15:35 02.03.2024 08:00 105 3 13.03.2024 15:35 14.03.2024 08:00 120 4 28.03....
Pirous's user avatar
  • 11
0 votes
1 answer
65 views

DFS (Depth-first search) vs BFS (Breadth-first search) Space Optimizations

Problem I am currently digging deep into some optimizations on the classical iterative approaches to both DFS and BFS algorithms. The material I'm currently using at my University presents both ...
Michel H's user avatar
  • 343
-4 votes
1 answer
86 views

C# For loop with try catch finally

I am trying to run for loop for every 5 secs to get the readings from COM port. When successful getting the readings only once. Would like to run the loop even if there is error. sometimes the ...
Diya's user avatar
  • 1
1 vote
1 answer
82 views

Can Excel functions solve iterative problems?

I want to use Microsoft Excel to project the growth of a pig farming project into which I will inject a fixed amount of cash per month and then use the cash to raise the number of full pigs that the ...
David Wanjiru's user avatar
0 votes
0 answers
22 views

Advanced if statements based on opened files

I am trying to encrypt the contents of an Excel file through iteration in a for loop, but I keep getting the error: TypeError: 'NoneType' object is not iterable My code: import tkinter import random ...
InfiniteWolf's user avatar
0 votes
0 answers
29 views

Update Blank Values Until the Next Populated Row PHP/MySQL

I don't know how to explain it well, or how to even ask. Here's some of my data: +------------+------------------------+ | Department | Product Number | +------------+------------------------+ ...
Craig Parker's user avatar
0 votes
2 answers
32 views

Setting the counter (j) for (inner for loop)

enter image description hereCan anyone tell me why we should set the counter j in the inner for loop to (i+1) not (i=0) (beacause I think setting j to i = 0 will get all elements in the array). And ...
Fady Saad's user avatar
0 votes
0 answers
59 views

How would I apply a rather complex summation formula like this in Excel?

This is the data table I am working with. This is the formula I need to apply in Excel. I want to clarify some notations. k_p_x means the probability that the individual aged x will survive for the ...
Jack Smith's user avatar
-1 votes
2 answers
73 views

Going back to an earlier index in list iteration

I have this loop over a list: MyList = ["test", "test2", "test3", "test4", "test5", "test6", "test7"] for item in MyList: ...
EliaOndacs's user avatar
0 votes
0 answers
66 views

Iteratively output (print to screen) pyspark dataframes via .toPandas()

I'm working in an .iypnb with pyspark and pandas. I'd like to be able to take my dataset (df) and loop through various columns, outputting a freq table of the values within that column. Doing so with ....
asdcx's user avatar
  • 1
2 votes
2 answers
272 views

Why next(iter(train_dataloader)) takes long execution time in PyTorch

I am trying to load a local dataset with images (around 225 images in total) using the following code: # Set the batch size BATCH_SIZE = 32 # Create data loaders train_dataloader, test_dataloader, ...
Jose Ramon's user avatar
  • 5,362
-2 votes
2 answers
100 views

Python: best way to iterate through lists and store which has max value for each index

In Python (3.8), I have 15 lists of the same length. Each list contains floats. Here for the example, I will pretend I have 3 lists of length 5 to demonstrate my problem: List1 = [29.561801, 29.564141,...
Tritize's user avatar
  • 39
0 votes
1 answer
72 views

iterate through a csv file using numpy

I have a CSV file with 4 columns with x, y positions for tracks. The 1st column is the ID of the track. The 2nd column is time. 3rd and 4th are X & Y co-ordinates. Now the X & Y positions ...
kamlesh bornani's user avatar

1
2 3 4 5
219