# Returning the n lowest values across columns in a dataframe

**URL:** <https://discourse.julialang.org/t/returning-the-n-lowest-values-across-columns-in-a-dataframe/81954>\
**Category:** New to Julia\
**Tags:** question, sortperm, dataframes\
**Created:** [May 31, 2022, 2:32am UTC](https://discourse.julialang.org/t/returning-the-n-lowest-values-across-columns-in-a-dataframe/81954 "2022-05-31T02:32:08Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [June 1, 2022, 12:35am UTC](https://discourse.julialang.org/t/returning-the-n-lowest-values-across-columns-in-a-dataframe/81954/4 "2022-06-01T00:35:07Z")

</div>

> [@Snowy](#):
>
> My first post was removed (not sure why), so here is try number 2…

> [@For each row, return n lowest column indexes or column names](https://discourse.julialang.org/t/for-each-row-return-n-lowest-column-indexes-or-column-names/81932):
>
> Hi all, New to Julia and seeking a little help. I am working with a dataframe and for each row, I want to return either the position of the lowest n values, or the column names of the lowest n value. The package DataStructures ([Heaps · DataStructures.jl](https://juliacollections.github.io/DataStructures.jl/latest/heaps/#Functions-using-heaps-1)) has a function that does this, but I really want to avoid loading a package just for this, as I’m sure the solution is relatively simple. Say my dataframe was as follows: df = DataFrame((name=["S1","S2","S3","S4","S5"],Z1=[41,12,19,17,11],Z2=…

---

_[View the full topic](https://discourse.julialang.org/t/returning-the-n-lowest-values-across-columns-in-a-dataframe/81954)._
