# \#splitapplycombine

**URL:** https://discourse.julialang.org/tag/splitapplycombine/911.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Groupby generic table-shaped things](https://discourse.julialang.org/t/groupby-generic-table-shaped-things/131074)

<div class="topic-metadata">

**Author:** [@freeman](https://discourse.julialang.org/u/freeman)\
**Replies:** 5\
**Last updated:** [July 29, 2025, 4:18pm UTC](https://discourse.julialang.org/t/groupby-generic-table-shaped-things/131074 "2025-07-29T16:18:48Z")

</div>

I know of Query.jl but frankly I hate both its syntaxes \[1, 2\]. (And also weirdly doesn’t depend on Tables.jl?) In the Tables.jl universe, I know of TableOperations.jl and TableTransforms.jl but weirdly neither of them …

---

## [Split-Apply-Combine in arrays](https://discourse.julialang.org/t/split-apply-combine-in-arrays/97907)

<div class="topic-metadata">

**Author:** [@PZacchia](https://discourse.julialang.org/u/PZacchia)\
**Replies:** 9\
**Last updated:** [April 28, 2023, 12:45pm UTC](https://discourse.julialang.org/t/split-apply-combine-in-arrays/97907 "2023-04-28T12:45:04Z")

</div>

Hello (first post on this forum)! I am new to Julia, transitioning from R. I am trying to implement a split-apply-combine strategy on a matrix without converting it into a DataFrame (reason: I need to do this operation f…

---

## [Summarizing Float64 values after grouping by different time scales from DateTime object](https://discourse.julialang.org/t/summarizing-float64-values-after-grouping-by-different-time-scales-from-datetime-object/90320)

<div class="topic-metadata">

**Author:** [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Replies:** 2\
**Last updated:** [December 21, 2022, 3:56pm UTC](https://discourse.julialang.org/t/summarizing-float64-values-after-grouping-by-different-time-scales-from-datetime-object/90320 "2022-12-21T15:56:59Z")

</div>

I have a data frame with two columns. Column time has datetime elements while column values has Float64 elements. I want to group the column time by year, month, day, and hour to calculate the average of the values. I c…

---

## [Summarizing grouped DataFrame where a group is entirely missing](https://discourse.julialang.org/t/summarizing-grouped-dataframe-where-a-group-is-entirely-missing/90920)

<div class="topic-metadata">

**Author:** [@mreichMPI-BGC](https://discourse.julialang.org/u/mreichMPI-BGC)\
**Replies:** 22\
**Last updated:** [December 18, 2022, 8:41pm UTC](https://discourse.julialang.org/t/summarizing-grouped-dataframe-where-a-group-is-entirely-missing/90920 "2022-12-18T20:41:43Z")

</div>

Dear community, when I want to summarize a grouped DataFrame e.g. with median and a group contains only missing, I get an error, because skipmissing returns an empty array and median(Float64\[\]) throws an error. The cod…

---

## [Broadcast over a multiple output function and receive a Tuple of Arrays](https://discourse.julialang.org/t/broadcast-over-a-multiple-output-function-and-receive-a-tuple-of-arrays/91111)

<div class="topic-metadata">

**Author:** [@bensetterholm](https://discourse.julialang.org/u/bensetterholm)\
**Replies:** 3\
**Last updated:** [December 1, 2022, 8:06pm UTC](https://discourse.julialang.org/t/broadcast-over-a-multiple-output-function-and-receive-a-tuple-of-arrays/91111 "2022-12-01T20:06:03Z")

</div>

Is there a convenient way to broadcast over a function that produces multiple outputs and receive a tuple of arrays instead of an array of tuples? For example, with the sincos function, I get the following output upon b…

---

## [Vector to lists of indices grouped by key](https://discourse.julialang.org/t/vector-to-lists-of-indices-grouped-by-key/85050)

<div class="topic-metadata">

**Author:** [@FireCrumb](https://discourse.julialang.org/u/FireCrumb)\
**Replies:** 9\
**Last updated:** [August 1, 2022, 11:00am UTC](https://discourse.julialang.org/t/vector-to-lists-of-indices-grouped-by-key/85050 "2022-08-01T11:00:46Z")

</div>

Hi, I have a vector of numbers: (in reality much larger) arr = Vector{Int64}(\[6, 9, 9, 4, 1, 1, 2, 7, 8, 3\]) I want to be able to generate the list of indices for each value: \> p = pairs(arr) pairs(::Vector{Int64})(.…

---

## [Grouping by Split, apply, combine](https://discourse.julialang.org/t/grouping-by-split-apply-combine/84417)

<div class="topic-metadata">

**Author:** [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Replies:** 9\
**Last updated:** [July 19, 2022, 10:06am UTC](https://discourse.julialang.org/t/grouping-by-split-apply-combine/84417 "2022-07-19T10:06:48Z")

</div>

I have a big set of 4-tuples and would like to group them based on their third position. As an example: using SplitApplyCombine A = \[(1,5,2,5), (,12,5,9,6), (7,5,2,6), (11,5,2,5), (8,5,9,6), (3,5,3,6), (7,5,9,6), (1,5,3…

---

## [How to map a function over the given axis of a multi-dimension array and return another array?](https://discourse.julialang.org/t/how-to-map-a-function-over-the-given-axis-of-a-multi-dimension-array-and-return-another-array/83586)

<div class="topic-metadata">

**Author:** [@zhangqian](https://discourse.julialang.org/u/zhangqian)\
**Replies:** 4\
**Last updated:** [July 1, 2022, 3:27pm UTC](https://discourse.julialang.org/t/how-to-map-a-function-over-the-given-axis-of-a-multi-dimension-array-and-return-another-array/83586 "2022-07-01T15:27:32Z")

</div>

I am trying to rotate some images, so I want to write something like np.array(list(map(lambda x: rotate(x), images))) in python, where the variable images is an array of shape \[N, H, W\]. Is there a method in julia that…

---

## [Concatenating 2D generator of arrays](https://discourse.julialang.org/t/concatenating-2d-generator-of-arrays/78775)

<div class="topic-metadata">

**Author:** [@jinml](https://discourse.julialang.org/u/jinml)\
**Replies:** 1\
**Last updated:** [March 31, 2022, 5:48am UTC](https://discourse.julialang.org/t/concatenating-2d-generator-of-arrays/78775 "2022-03-31T05:48:23Z")

</div>

Hi, I’m trying to concatenate an 2D generator that generate an 2D array of 2x2 arrays, such as this one iter = (rand(2,2) for i in 1:d1, j in 1:d2 ) I would need to concatenate these arrays into a 2 by d1 by 2 by d2 ar…

---

## [What's julia's solution to tapply or accumarray?](https://discourse.julialang.org/t/whats-julias-solution-to-tapply-or-accumarray/70055)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 15\
**Last updated:** [January 3, 2022, 10:36pm UTC](https://discourse.julialang.org/t/whats-julias-solution-to-tapply-or-accumarray/70055 "2022-01-03T22:36:41Z")

</div>

I have one-column Index as the below: A = \[1, 2, 2, 3, 3, 3\]; I have a matrix B as the below: B = \[1 2 3; 2 3 4; 3 4 5; 4 5 6; 5 6 7; 6 7 8\]; I would want to calculate the average of the duplicate rows based on Index…

---

## [Efficiently finding the frequency of patterns in DataFrame columns](https://discourse.julialang.org/t/efficiently-finding-the-frequency-of-patterns-in-dataframe-columns/73839)

<div class="topic-metadata">

**Author:** [@Matthew](https://discourse.julialang.org/u/Matthew)\
**Replies:** 12\
**Last updated:** [January 1, 2022, 9:27pm UTC](https://discourse.julialang.org/t/efficiently-finding-the-frequency-of-patterns-in-dataframe-columns/73839 "2022-01-01T21:27:58Z")

</div>

Hi all! I’m looking for help with what might be an easy task. Say we have two vectors; A = \[0,1\] and B = \[0,1,2\]. Matrix C contains every possible combination of A and B such that it has dimensions 6x2. Now consider a…

---

## [Transpose vector of vectors](https://discourse.julialang.org/t/transpose-vector-of-vectors/73313)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 11\
**Last updated:** [December 19, 2021, 1:26pm UTC](https://discourse.julialang.org/t/transpose-vector-of-vectors/73313 "2021-12-19T13:26:58Z")

</div>

Is there a shorter way to write this? n = 1000; m = 5000 xss = \[repeat(\[j\], n) for j in 1:m\] yss = \[\[\] for \_ in xss\[1\]\] for xs in xss for (x, ys) in zip(xs, yss) push!(ys, x) end end Maybe there is an…

---

## [Positions in an array](https://discourse.julialang.org/t/positions-in-an-array/73157)

<div class="topic-metadata">

**Author:** [@Mariana](https://discourse.julialang.org/u/Mariana)\
**Replies:** 6\
**Last updated:** [December 15, 2021, 9:53pm UTC](https://discourse.julialang.org/t/positions-in-an-array/73157 "2021-12-15T21:53:58Z")

</div>

Hello! I have a 15360x3 array and the last column may only assume three different values: -1, 1, or 2. I’d like to obtain arrays with the positions in this array where the third column assumes each of these possible val…

---

## [Count various patterns simultaneously](https://discourse.julialang.org/t/count-various-patterns-simultaneously/73066)

<div class="topic-metadata">

**Author:** [@ludwig-austermann](https://discourse.julialang.org/u/ludwig-austermann)\
**Replies:** 5\
**Last updated:** [December 14, 2021, 1:34pm UTC](https://discourse.julialang.org/t/count-various-patterns-simultaneously/73066 "2021-12-14T13:34:10Z")

</div>

I was just wondering if there is a nicer way to do practically this: reduce( (d, c) -\> (d\[c\] = get(d, c, 0) + 1; d), "ACCACD", init=Dict{Char, Int}() ) hence, to do a non-binary count s = "ACCACD" Dict( c =\> c…

---

## [Sampling Groups and individual within the group](https://discourse.julialang.org/t/sampling-groups-and-individual-within-the-group/72199)

<div class="topic-metadata">

**Author:** [@N\_A](https://discourse.julialang.org/u/N_A)\
**Replies:** 4\
**Last updated:** [November 28, 2021, 2:54pm UTC](https://discourse.julialang.org/t/sampling-groups-and-individual-within-the-group/72199 "2021-11-28T14:54:36Z")

</div>

a\[:,4\] represent group. a= \[1 2 3 1;5 6 7 1;1 2 3 1;1 2 4 1;1 2 3 2;1 2 3 2;1 2 4 2;1 2 4 2;1 3 4 3;1 3 4 3;1 3 4 3;1 2 3 3 \] 12×4 Matrix{Int64}: 1 2 3 1 5 6 7 1 1 2 3 1 1 2 4 1 1 2 3 2 1 2 3 2 …

---

## [Fast way to calculate statistics of an array based on values (labels) of another array](https://discourse.julialang.org/t/fast-way-to-calculate-statistics-of-an-array-based-on-values-labels-of-another-array/70054)

<div class="topic-metadata">

**Author:** [@Bjorn\_De](https://discourse.julialang.org/u/Bjorn_De)\
**Replies:** 7\
**Last updated:** [October 20, 2021, 7:17am UTC](https://discourse.julialang.org/t/fast-way-to-calculate-statistics-of-an-array-based-on-values-labels-of-another-array/70054 "2021-10-20T07:17:42Z")

</div>

Hey, I have two arrays of the same size (10000x10000). One array include labels as result of an segmentation. What I want is to compute statistics for each of these segments based on the 2nd array. My approach is very s…

---

## [Transforming an Array{Matrix{T, N}, M} to an Array{T, N+M}](https://discourse.julialang.org/t/transforming-an-array-matrix-t-n-m-to-an-array-t-n-m/65192)

<div class="topic-metadata">

**Author:** [@mmaeusezahl](https://discourse.julialang.org/u/mmaeusezahl)\
**Replies:** 10\
**Last updated:** [July 24, 2021, 3:29pm UTC](https://discourse.julialang.org/t/transforming-an-array-matrix-t-n-m-to-an-array-t-n-m/65192 "2021-07-24T15:29:27Z")

</div>

Hi, usually I had a lot of success discovering the various ways to transform the Array datatypes into each other but this one gives me some headaches: From a parallelized operation I end up with an array (with an arbitr…

---

## [A nice use case for DataFrames.jl - flexible dedup](https://discourse.julialang.org/t/a-nice-use-case-for-dataframes-jl-flexible-dedup/64725)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 4\
**Last updated:** [July 16, 2021, 7:53am UTC](https://discourse.julialang.org/t/a-nice-use-case-for-dataframes-jl-flexible-dedup/64725 "2021-07-16T07:53:34Z")

</div>

I had this problem where I need to dedup a dataframe using a column, but there is a timestamp column for all the entries. If two entries have the same data, but different timestamp, I would want ot keep only the one with…

---

## [Operations on Arrays of CartesianIndex](https://discourse.julialang.org/t/operations-on-arrays-of-cartesianindex/58827)

<div class="topic-metadata">

**Author:** [@ethomag](https://discourse.julialang.org/u/ethomag)\
**Replies:** 2\
**Last updated:** [April 9, 2021, 5:01am UTC](https://discourse.julialang.org/t/operations-on-arrays-of-cartesianindex/58827 "2021-04-09T05:01:06Z")

</div>

I came across a problem that I found surprisingly hard, given Julias excellent support for indexing multidimensional Arrays. I lilke to apply some function along one axis on parts of an Array. The parts are defined by s…

---

## [Is there a way to "enumerate" \`mapslices\` other than\`\`\`i = 0result = mapslices(m](https://discourse.julialang.org/t/is-there-a-way-to-enumerate-mapslices-other-than-i-0result-mapslices-m/55414)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 3\
**Last updated:** [February 17, 2021, 9:39am UTC](https://discourse.julialang.org/t/is-there-a-way-to-enumerate-mapslices-other-than-i-0result-mapslices-m/55414 "2021-02-17T09:39:06Z")

</div>

Is there a way to “enumerate” mapslices other than i = 0 result = mapslices(myarray; dims=dims) do x i += 1 myfunction(x, i) end ? Note that the original poster on Slack cannot see your response here on Discou…

---

## [Package for lazy concatenation along arbitrary higher dimensions?](https://discourse.julialang.org/t/package-for-lazy-concatenation-along-arbitrary-higher-dimensions/55413)

<div class="topic-metadata">

**Author:** [@tlnagy](https://discourse.julialang.org/u/tlnagy)\
**Replies:** 4\
**Last updated:** [February 17, 2021, 7:17am UTC](https://discourse.julialang.org/t/package-for-lazy-concatenation-along-arbitrary-higher-dimensions/55413 "2021-02-17T07:17:57Z")

</div>

Are there any packages that let you concatenate lazily along arbitrary dimensions like the eager cat does? julia\> mats = \[rand(5,6,7,8), rand(5,6,7,8)\]; julia\> combo = cat(mats..., dims=3); # this, but lazy julia\> siz…

---

## [Problem Adding a dimesion to array/vector](https://discourse.julialang.org/t/problem-adding-a-dimesion-to-array-vector/51431)

<div class="topic-metadata">

**Author:** [@lorrp1](https://discourse.julialang.org/u/lorrp1)\
**Replies:** 7\
**Last updated:** [December 8, 2020, 8:01pm UTC](https://discourse.julialang.org/t/problem-adding-a-dimesion-to-array-vector/51431 "2020-12-08T20:01:15Z")

</div>

Hello, i have a Vector{Any} with 25701 elements made of: 100×40 Array{Float64,2} id like to add a dimension to it so from 25701 \* 100 \* 40\*1 i have tried like written here https://stackoverflow.com/questions/4231231…

---

## [Dynamically split DataFrame into bins](https://discourse.julialang.org/t/dynamically-split-dataframe-into-bins/48046)

<div class="topic-metadata">

**Author:** [@fbanning](https://discourse.julialang.org/u/fbanning)\
**Replies:** 4\
**Last updated:** [October 12, 2020, 3:27pm UTC](https://discourse.julialang.org/t/dynamically-split-dataframe-into-bins/48046 "2020-10-12T15:27:45Z")

</div>

I suppose this is a simple thing to do but I don’t quite know what to search for. I’m currently wondering how I can dynamically split a DataFrame into equal size bins. using DataFrames, StatsPlots df = DataFrame(a = ra…

---

## [Arbitrary table join conditions](https://discourse.julialang.org/t/arbitrary-table-join-conditions/44825)

<div class="topic-metadata">

**Author:** [@derekmahar](https://discourse.julialang.org/u/derekmahar)\
**Replies:** 9\
**Last updated:** [August 16, 2020, 12:47am UTC](https://discourse.julialang.org/t/arbitrary-table-join-conditions/44825 "2020-08-16T00:47:22Z")

</div>

What Julia tabular data types and functions might I use in order to join two tables using a join condition that is more complex than simple equality between sets of columns in each table (an equi-join)? As far as I can …

---

## [Multi of word in dict](https://discourse.julialang.org/t/multi-of-word-in-dict/44504)

<div class="topic-metadata">

**Author:** [@Fuad\_Sami](https://discourse.julialang.org/u/Fuad_Sami)\
**Replies:** 6\
**Last updated:** [August 7, 2020, 8:45pm UTC](https://discourse.julialang.org/t/multi-of-word-in-dict/44504 "2020-08-07T20:45:58Z")

</div>

Hello all i need to do some thing like that in the dictionary Dict(314 =\> \["ate","eat","tea"\],311 =\> \["bat"\],323 =\> \["nat","tan"\]) iand this is my code function groupAnagrams(str) \*\*d = Dict{Int64,Array{String,1…

---

## [SplitApplyCombine.jl \`group\` enhancements, reaches version 1.0.0](https://discourse.julialang.org/t/splitapplycombine-jl-group-enhancements-reaches-version-1-0-0/32675)

<div class="topic-metadata">

**Author:** [@andyferris](https://discourse.julialang.org/u/andyferris)\
**Replies:** 1\
**Last updated:** [December 25, 2019, 3:13am UTC](https://discourse.julialang.org/t/splitapplycombine-jl-group-enhancements-reaches-version-1-0-0/32675 "2019-12-25T03:13:07Z")

</div>

Merry Chirstmas everybody, Today I have released version 1.0.0 of SplitApplyCombine.jl, with the headline feature being that grouping functions have moved to returning a dictionary from Dictionaries.jl. On a personal n…

---

## [Counting number of occurences in an array](https://discourse.julialang.org/t/counting-number-of-occurences-in-an-array/31613)

<div class="topic-metadata">

**Author:** [@WEEZEERAE](https://discourse.julialang.org/u/WEEZEERAE)\
**Replies:** 10\
**Last updated:** [December 18, 2019, 7:33am UTC](https://discourse.julialang.org/t/counting-number-of-occurences-in-an-array/31613 "2019-12-18T07:33:39Z")

</div>

Hey people, I’m struggling with the following problem: I want to count the number of occurances for the values in an array, s.t. I can plot the result. I.e. this is the array: A = \[1,2,3,3,4,4,4,6\] and I want to fin…

---

## [Working with posteriors](https://discourse.julialang.org/t/working-with-posteriors/19846)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 7\
**Last updated:** [January 22, 2019, 10:45am UTC](https://discourse.julialang.org/t/working-with-posteriors/19846 "2019-01-22T10:45:13Z")

</div>

Finding that I am writing a lot of repetitive code, I am trying to rethink the way I work with posterior distributions (eg from MCMC). I can typically reduce most operations on posteriors to transformations, which opera…

---

## [Alternative to mapslices that does not allocate slices](https://discourse.julialang.org/t/alternative-to-mapslices-that-does-not-allocate-slices/13820)

<div class="topic-metadata">

**Author:** [@piever](https://discourse.julialang.org/u/piever)\
**Replies:** 8\
**Last updated:** [September 12, 2018, 1:28pm UTC](https://discourse.julialang.org/t/alternative-to-mapslices-that-does-not-allocate-slices/13820 "2018-09-12T13:28:09Z")

</div>

I’m trying to understand whether there is a non-allocating equivalent of mapslices. I often end up needing to reduce sliced views, for example: mapslices(sum, m, dims = n) And I would like to figure out a way that does…
