# RDataFrame Min function does not compile

**URL:** <https://root-forum.cern.ch/t/rdataframe-min-function-does-not-compile/41573>\
**Category:** Newbie\
**Tags:** rdataframe, python\
**Created:** [September 24, 2020, 9:37am UTC](https://root-forum.cern.ch/t/rdataframe-min-function-does-not-compile/41573 "2020-09-24T09:37:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tancredi](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/tancredi/32/20395_2.png) [@tancredi](https://root-forum.cern.ch/u/tancredi)\
**Post date:** [September 24, 2020, 9:37am UTC](https://root-forum.cern.ch/t/rdataframe-min-function-does-not-compile/41573/1 "2020-09-24T09:37:14Z")

</div>

Hello,

I can not compile the Min() function in the RDataFrame class (Max() works by the way…)

I attach [test.py](https://root-forum.cern.ch/uploads/short-url/uoKcUCjmmqwkkD3AfpV91BT9dut.py) (574 Bytes) a simple macro where you can see the problem. Here is the result on lxplus:

python -i test.py  
min= In file included from /builddir/build/BUILD/root-6.22.02/x86\_64-redhat-linux-gnu/input\_line\_12:15:  
In file included from /builddir/build/BUILD/root-6.22.02/x86\_64-redhat-linux-gnu/etc/dictpch/allHeaders.h:973:  
In file included from /builddir/build/BUILD/root-6.22.02/x86\_64-redhat-linux-gnu/include/ROOT/RCsvDS.hxx:14:  
In file included from /builddir/build/BUILD/root-6.22.02/x86\_64-redhat-linux-gnu/include/ROOT/RDataFrame.hxx:20:  
In file included from /builddir/build/BUILD/root-6.22.02/x86\_64-redhat-linux-gnu/include/ROOT/RDF/RInterface.hxx:15:  
/builddir/build/BUILD/root-6.22.02/x86\_64-redhat-linux-gnu/include/ROOT/RDF/ActionHelpers.hxx:734:24: error: no matching function for call to ‘min’  
fMins[slot] = std::min(v, fMins[slot]);  
^ ~~~~~~~  
/builddir/build/BUILD/root-6.22.02/x86\_64-redhat-linux-gnu/include/ROOT/RDF/RAction.hxx:237:33: note: in instantiation of function template specialization ‘ROOT::Internal::RDF::MinHelper::Exec\<ROOT::VecOps::RVec, 0\>’ requested here

Thank you for your help.

```
     Tancredi     

```

\_ROOT Version: root-6.22.02/  
\_Platform: lxplus  
\_Compiler: x86\_64-redhat-linux-gnu

* * *

2020-09-23T22:00:00Z

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [September 24, 2020, 10:35am UTC](https://root-forum.cern.ch/t/rdataframe-min-function-does-not-compile/41573/2 "2020-09-24T10:35:14Z")

</div>

Hi,  
I’m not sure why the error message is so obscure. When I try to execute your script, with ROOT 6.22.02 installed via conda, here’s what I get:

```auto
~/Downloads python -i test.py (root-6-22-02) 
Traceback (most recent call last):
  File "test.py", line 18, in <module>
    print('min= ',df["data"].Min("photon_eta[0]").GetValue())
cppyy.gbl.std.runtime_error: Template method resolution failed:
  ROOT::RDF::RResultPtr<double> ROOT::RDF::RInterface<ROOT::Detail::RDF::RLoopManager,void>::Min(basic_string_view<char,char_traits<char> > columnName = "") =>
    runtime_error: Unknown column: photon_eta[0]
  ROOT::RDF::RResultPtr<double> ROOT::RDF::RInterface<ROOT::Detail::RDF::RLoopManager,void>::Min(basic_string_view<char,char_traits<char> > columnName = "") =>
    runtime_error: Unknown column: photon_eta[0]

```

And indeed the problem is that `Min("photon_eta[0]")` should be e.g. `Define("ph_eta0", "photon_eta[0]").Min("ph_eta0")`: actions like `Min` only accept column names, they don’t know how to evaluate expressions such as `"photon_eta[0]"` (`Define` can be used to evaluate expressions).

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![tancredi](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/tancredi/32/20395_2.png) [@tancredi](https://root-forum.cern.ch/u/tancredi)\
**Post date:** [September 24, 2020, 11:00am UTC](https://root-forum.cern.ch/t/rdataframe-min-function-does-not-compile/41573/3 "2020-09-24T11:00:40Z")

</div>

Hello,

yes this work.

I had started the investigation with  
print 'min= ',df[“data”].Min(“photon\_eta”).GetValue()  
print 'max= ',df[“data”].Max(“photon\_eta”).GetValue()

The MAX work while the MIN gives the same error as about.

Regards,  
Tancredi

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [September 24, 2020, 1:55pm UTC](https://root-forum.cern.ch/t/rdataframe-min-function-does-not-compile/41573/4 "2020-09-24T13:55:21Z")

</div>

Ok I see the problem, this is now [https://github.com/root-project/root/issues/6435](https://github.com/root-project/root/issues/6435) . Work in progress.

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [September 24, 2020, 2:33pm UTC](https://root-forum.cern.ch/t/rdataframe-min-function-does-not-compile/41573/5 "2020-09-24T14:33:18Z")

</div>

Hi again, the bug is understood and [a fix is in the pipeline](https://github.com/root-project/root/pull/6436).

In Python, I can suggest to use `Stats` instead of `Min`/`Max` to work around the issue:

```python
stats = df["data"].Stats("photon_eta").GetValue()
min = stats.GetMin()
max = stats.GetMax()

```

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [September 25, 2020, 8:57am UTC](https://root-forum.cern.ch/t/rdataframe-min-function-does-not-compile/41573/6 "2020-09-25T08:57:32Z")

</div>

The fix will be in ROOT v6.24 and v6.22/04. Thanks for the report!
