cumulative-sum Questions

2

Solved

Relevant info: Grafana v5.4.2 (commit: d812109) ElasticSearch version: 5.6.8 There is an ES index that is a log of events over time, and the events are categorised (per country). There is a gr...
Raffarty asked 25/7, 2019 at 13:30

12

Solved

I have a csv string containing doubles (e.g "0.3,0.4,0.3"), and I want to be able to output a double array containing the cumulative sum of these numbers (e.g [0.3,0.7,1.0]). So far, I have doub...
Shultz asked 28/1, 2011 at 0:17

2

Solved

I have df = pd.DataFrame.from_dict({'id': ['A', 'B', 'A', 'C', 'D', 'B', 'C'], 'val': [1,2,-3,1,5,6,-2], 'stuff':['12','23232','13','1234','3235','3236','732323']}) id stuff val 0 A 12 1 1 B 2323...
Olid asked 29/9, 2015 at 15:18

2

Solved

I'm trying to get x and y coordinates of all cumulative maximums in a vector. I wrote a naive for-loop but I have a feeling there is some way to do it with numpy that's more elegant. Does anyone k...
Jailbird asked 19/4, 2018 at 17:44

14

Solved

I want to get a running total from a list of numbers. For demo purposes, I start with a sequential list of numbers using range a = range(20) runningTotal = [] for n in range(len(a)): new = runn...
Opsonize asked 8/8, 2010 at 2:19

14

How would you do to transform a Column in a table from this: ColumnA ColumnB 2 a 3 b 4 c 5 d 1 a to this: ColumnA ColumnB 3 a 6(=3+3) b 10(=4+3+3) c 15(=5+4+3+3) d I'm interested to see e...
Anglophobia asked 1/10, 2012 at 7:1

2

Solved

i'm building an excel model using dynamic arrays which may expand horizontally or vertically depending on the inputs Example of the array: 1 2 3 4 5 6 7 8 I'm trying to calculate ...
Microscopy asked 8/10, 2022 at 10:27

3

Solved

I have a DataFrame like this: df: fruit val1 val2 0 orange 15 3 1 apple 10 13 2 mango 5 5 How do I get Pandas to give me a cumulative sum and percentage column on only val1? Desired output: ...
Ribbentrop asked 7/1, 2014 at 6:11

4

It's important to know that the date will be unknown during the query time, so I cannot just hard code a 'WHERE' clause. Here's my table: +-----------+----------+-------------+ | Date_ID | Custom...
Nickel asked 30/7, 2015 at 21:43

5

Solved

I have a numeric vector like this x <- c(1, 23, 7, 10, 9, 2, 4) and I want to group the elements from left to right with the constrain that each group sum must not exceed 25. Thus, here the firs...
Brune asked 26/1, 2022 at 8:41

4

Sample Documents: { time: ISODate("2013-10-10T20:55:36Z"), value: 1 } { time: ISODate("2013-10-10T22:43:16Z"), value: 2 } { time: ISODate("2013-10-11T19:12:66Z"), val...
Pretended asked 24/4, 2013 at 11:43

2

Solved

I'm developing a simple financial app for keeping track of incomes and outcomes. For the sake of simplicity, let's suppose these are some of my documents: { description: "test1", amount: ...

2

Solved

As per Wikipedia: A summed area table is a data structure and algorithm for quickly and efficiently generating the sum of values in a rectangular subset of a grid. For a 2D space a summed area ta...
Transduction asked 7/12, 2013 at 18:43

2

Note: This may involve a good deal of number theory, but the formula I found online is only an approximation, so I believe an exact solution requires some sort of iterative calculation by a compute...
Winniewinnifred asked 30/4, 2021 at 21:43

7

I want to do a running total with power query like I did with Tableau software before. Does anyone have ideas, thanks in advance!
Underpart asked 29/6, 2015 at 9:30

1

I am doing a ledger for accounting purposes. I have it set up like a checkbook registry. It has 4 columns: Date, Description, Amount and Balance. The formula set up in the last column (Balance) is ...
Stockstill asked 2/1, 2021 at 23:36

2

We have dataframe like below : +------+--------------------+ | Flag | value| +------+--------------------+ |1 |5 | |1 |4 | |1 |3 | |1 |5 | |1 |6 | |1 |4 | |1 |7 | |1 |5 | |1 |2 | |1 |3 | |1 |2 | |...
Oyer asked 18/11, 2017 at 9:52

9

Solved

I have a table that looks like this: id count 1 100 2 50 3 10 I want to add a new column called cumulative_sum, so the table would look like this: id count cumulative_sum 1 100 100 2 50 150 3 1...
Rewire asked 1/4, 2010 at 21:50

3

Solved

I'm trying to calculate a discounted cumulative sum in which the later values are worth more. Let's say I have the following dataset: dt <- data.table( "year" = c(79,80,81,82,83), "value" = c...
Lyte asked 14/5, 2020 at 15:58

4

Solved

I have an integer array of values and want to find a simple way of calculating its cumulative sum (S = Data(1) + Data(2) + ... + Data(x)). I already created this function: Function CumulativeSum(...
Wendish asked 21/9, 2017 at 12:20

6

Solved

I want to create a cumulative counter of the number of times each value appears. e.g. say I have the column: id 1 2 3 2 2 1 2 3 This would become: id count 1 1 2 1 3 1 2 2 2 3 ...
Meggy asked 5/4, 2012 at 13:9

2

I have a table S with time series data like this: key day delta For a given key, it's possible but unlikely that days will be missing. I'd like to construct a cumulative column from the delta v...
Hukill asked 5/8, 2011 at 1:8

3

Solved

The function below groups values in a vector based on whether the cumulative sum has reached a certain max value and then starts over. cs_group <- function(x, threshold) { cumsum <- 0 gro...
Bagby asked 5/2, 2020 at 11:36

2

Solved

As you can see from my picture, I have a list of bowling scores and some running averages. The issue I cannot seem to solve is I would like to be able to see the change in average between a game ...

2

Solved

I have a dataframe with annual price and dividend data for numerous companies. I am looking to calculate the 3-year annualized return by adding all of the dividends received during the three years ...

© 2022 - 2025 — McMap. All rights reserved.