Skip to main content
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
0 votes
1 answer
55 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,...
Jerry Sizzler's user avatar
Best practices
0 votes
4 replies
122 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 ...
Michael's user avatar
  • 507
-2 votes
0 answers
60 views

Why does list append inside a loop duplicate the last element? [duplicate]

I’m trying to append values to a list inside a loop, but instead of getting different values, the last value keeps getting duplicated. Here is a simplified version of my code: result = [] temp = [] ...
Suhani Kumari's user avatar
-4 votes
0 answers
45 views

Why is my Python dictionary iteration skipping keys when i modify it inside the loop? [duplicate]

I am to update a python dictionary while iterating over it, but some keys are getting skipp data = { "a": 1, "b": 2, "c": 3, "d": 4 } for key ...
K.Venkata Ramanna's user avatar
6 votes
4 answers
190 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 ...
Matteo's user avatar
  • 537
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 ...
Victor's user avatar
  • 1
Advice
1 vote
8 replies
145 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 ...
Stanislav Matveyevich's user avatar
Best practices
1 vote
0 replies
71 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 ...
UgaitzG's user avatar
  • 57
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 ...
triangle_coder's user avatar
0 votes
2 answers
120 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 ...
Allison Rodgers's user avatar
3 votes
0 answers
106 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 ...
Claris's user avatar
  • 31
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 & ...
Moriah's user avatar
  • 27
3 votes
1 answer
142 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 ...
Shmuel Greenberger's user avatar
0 votes
1 answer
90 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 :...
Ebrahim's user avatar
  • 25
-1 votes
0 answers
82 views

Plotting xts object in loop fails [duplicate]

I want to plot several time series (xts) in R in a loop. However, that does not work, I only get "empty" devices. So I wrote a little test: library('xts') testdata <- c(1:100) testdata....
smoff's user avatar
  • 658

15 30 50 per page
1
2 3 4 5
6444
Morty Proxy This is a proxified and sanitized view of the page, visit original site.