# How to compute a "cumulative" in a dataframe (without a for loop)

**URL:** <https://discourse.julialang.org/t/how-to-compute-a-cumulative-in-a-dataframe-without-a-for-loop/2156>\
**Category:** Data\
**Tags:** question, dataframes\
**Created:** [February 17, 2017, 4:10pm UTC](https://discourse.julialang.org/t/how-to-compute-a-cumulative-in-a-dataframe-without-a-for-loop/2156 "2017-02-17T16:10:53Z")\
**Posts on this page:** 1\
**Showing post:** 44

<div class="post-metadata">

**Author:** ![SubTer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/subter/32/28830_2.png) [@SubTer](https://discourse.julialang.org/u/SubTer)\
**Post date:** [September 10, 2021, 8:27pm UTC](https://discourse.julialang.org/t/how-to-compute-a-cumulative-in-a-dataframe-without-a-for-loop/2156/44 "2021-09-10T20:27:24Z")

</div>

hmmm interesting… it does look like something sneaks in that has a row count of 10… well at least the arrays arent crazy…i am.

df that works:

```julia
2×7 DataFrame
 Row │ variable mean min median max nmissing eltype
     │ Symbol Float64 Signed Float64 Signed Int64 Type
─────┼──────────────────────────────────────────────────────────────────────────────────────
   1 │ xxxxxID 6.29382e5 600339 6.33712e5 634550 0 Union{Missing, Int32}
   2 │ nrow 58.9706 50 60.0 60 0 Int64

```

df that fails:

```julia
2×7 DataFrame
 Row │ variable mean min median max nmissing eltype
     │ Symbol Float64 Signed Float64 Signed Int64 Type
─────┼────────────────────────────────────────────────────────────────────────────────────
   1 │ xxxxxID 6.29566e5 600339 633750.0 634628 0 Union{Missing, Int32}
   2 │ nrow 58.539 10 60.0 60 0 Int64

```

guess that leads to next question - can you use @chain count functions to mass remove anything that counts below window span in the transform function, all in the same linq call?

---

_[View the full topic](https://discourse.julialang.org/t/how-to-compute-a-cumulative-in-a-dataframe-without-a-for-loop/2156)._
