96,646 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-1
votes
0
answers
83
views
Best approaches to applying a function to more than one column in df at once? [duplicate]
Say I have a pandas dataframe of > 2 columns and > 2 rows, I want to apply a function, such as a datatype conversion, to each element in at least two columns. I would like for it to be efficient,...
Best practices
0
votes
4
replies
124
views
Best method to loop a list while removing items
I have a list of ranges that consist of a start and end value. I need to optimise the list by identifying any overlapping ranges and merging them so that there is no duplication on the list.
I have ...
6
votes
4
answers
210
views
awk command to subtract constant from a column and print results
I was working on a one-liner to subtract a constant value (e.g. 100 in this case) from a specific column using awk. So far I can manage to get to where I can print the last iteration only – which ...
0
votes
0
answers
167
views
As part of a function, how could I create a variable number of sums one inside another based on a parameter?
I'm currently struggling on an assignment (probability class) which require creating a function (VBA excel) that contains a variable number of sums one inside the other based on a parameter. I'm not ...
Advice
1
vote
8
replies
146
views
Making a palindrome out of a string of random letters (or any given value type inputs)
Found this code exercise on W3R. Been trying to figure out the relationship between the outer and inner loop (i and j), but can't seem to wrap my head around it. If anyone could walk me through this ...
Best practices
1
vote
0
replies
73
views
Ansible: mysql_query loop and some rows for each
How can I manage a mysql_query result when query is looping a list and if each queries iteration returns some rows?
I want the results to be stored in a dictionary. Then I will check if each perm is ...
Best practices
0
votes
2
replies
130
views
Looping Datasets in R
Essentially I am trying to create a dataset that is dependent on prior rows to generate values for any given row. I then would like to run this loop over many IDs for an entire dataset. Current set up ...
0
votes
2
answers
127
views
Excel Macro Loop. Looking for code to loop through entire workbook
I am new to making macros and have basically no experience with VBA. However, I have managed to cobble together the code below.
The code is supposed to load data from a worksheet (the name of which I ...
3
votes
0
answers
107
views
How can I plot diagonals of matrix?
I want to plot all the diagonals of a matrix. In the matrix row 1 contains information of time 1, row 2 of time 2 etc etc. Each diagonal presents the evolution of the number of fishes in a cohort that ...
Advice
0
votes
4
replies
76
views
Calculating resistance and resilience of a soil microbial community
I want to calculate resistance and resilience of the soil microbial community in my experiment.
I have an experimental design with 4 treatments: ambient (control), drought, warmed, and warmed & ...
3
votes
1
answer
146
views
How to write an accumulative recursive function in J without looping
At the risk of asking a question with an obvious solution: if I have a function in J that takes two arguments and returns two arguments and I want to accumulate the answer's second argument and to use ...
0
votes
1
answer
91
views
How can I create triangles and squares with a for loop?
I used this method to draw squares and triangles on the paint box:
procedure squarClick(Sender: TObject);
begin
canvas.Pen.Color := clgreen;
canvas.Pen.Style := psSolid;
canvas.Pen.Width :...
1
vote
1
answer
83
views
Scheme: calling `define-syntax-rule` in a loop
I wonder whether it is possible to call define-syntax-rule in a loop-like construction like for-each. I explicitly say 'loop-like' because I know that normal Scheme evaluation comes after macro ...
-3
votes
1
answer
134
views
Console.ReadLine in a Task causing side effects [duplicate]
I want to loop and ask user if he wants to continue. If no answer for a while, loop anyway.
while (true)
{
Console.WriteLine("\nDo you want to continue? (Type 'no' or 'exit' to break, or wait ...
-1
votes
1
answer
53
views
How to loop an Apps Script / Cheerio web scraper over multiple urls? [closed]
I have this Apps Script / Cheerio function that successfully scrapes the data I want from the url. The site only displays 25 entries at this url. I can find additional entries on subsequent pages (by ...