# Create grouped dataframe by properties of a given column?

**URL:** <https://discourse.julialang.org/t/create-grouped-dataframe-by-properties-of-a-given-column/113360>\
**Category:** New to Julia\
**Tags:** dataframes, grouped-data\
**Created:** [April 22, 2024, 9:44pm UTC](https://discourse.julialang.org/t/create-grouped-dataframe-by-properties-of-a-given-column/113360 "2024-04-22T21:44:29Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![phantom](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@phantom](https://discourse.julialang.org/u/phantom)\
**Post date:** [April 26, 2024, 1:55pm UTC](https://discourse.julialang.org/t/create-grouped-dataframe-by-properties-of-a-given-column/113360/9 "2024-04-26T13:55:30Z")

</div>

Would it have to do with how `sortperm` handles the `by` kwarg? If it’s handled the same way you mentioned [here](https://discourse.julialang.org/t/using-findfirst-with-for-multiple-values-and-columns-in-a-dataframe/111953/13).

> [@Using findfirst with for multiple values and columns in a Dataframe?](https://discourse.julialang.org/t/using-findfirst-with-for-multiple-values-and-columns-in-a-dataframe/111953/16):
>
> The function has this fingerprint `searchsortedfirst(a, x; by=<transform>, lt=<comparison>, rev=false)`.  
> The comparison between the value to be searched for x and the candidate values a\_i is done in the following way `lt(by(x),by(a_i))` until the first `a_i >=x` is found.

Then could `sortperm` be computing` f(data)` multiple times to sort the data whereas with

> [@rocco\_sprmnt21](#):
>
> ```julia
> fdata=f.(data)
> spi=sortperm(fdata)
> 
> ```

`f.(data)` is calculated just once?

---

_[View the full topic](https://discourse.julialang.org/t/create-grouped-dataframe-by-properties-of-a-given-column/113360)._
