# Index of max values of N columns in a DataFrame without manually entering each column

**URL:** <https://discourse.julialang.org/t/index-of-max-values-of-n-columns-in-a-dataframe-without-manually-entering-each-column/92532>\
**Category:** New to Julia\
**Tags:** question, indexing, dataframes, maxima\
**Created:** [January 5, 2023, 12:50am UTC](https://discourse.julialang.org/t/index-of-max-values-of-n-columns-in-a-dataframe-without-manually-entering-each-column/92532 "2023-01-05T00:50:01Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![rocco\_sprmnt21](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocco_sprmnt21/32/20127_2.png) [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Post date:** [January 7, 2023, 9:08pm UTC](https://discourse.julialang.org/t/index-of-max-values-of-n-columns-in-a-dataframe-without-manually-entering-each-column/92532/16 "2023-01-07T21:08:14Z")

</div>

or maximum for row-wise maximum using the zip function

```julia
maximum.(zip([df[!,c] for c in names(df) if c!="C"]...));

```

```julia
df[sortperm([maximum(r) for r in zip([df[!,c] for c in filter(!=("C"), names(df) )]...)], lt= >= ),:]

```

PS

it seems that [the last form](https://discourse.julialang.org/t/sortperm-with-keyword-lt-isless-crashes-languageserver/92648) has problems.

---

_[View the full topic](https://discourse.julialang.org/t/index-of-max-values-of-n-columns-in-a-dataframe-without-manually-entering-each-column/92532)._
