diff --git a/bindings/pyroot/ROOT.py b/bindings/pyroot/ROOT.py
index 26a3da7f3c4de2cfd2a79d50f1948d18c97831d5..d291a806c4ec811d667ba90a38baad1ffe4f3102 100644
--- a/bindings/pyroot/ROOT.py
+++ b/bindings/pyroot/ROOT.py
@@ -357,10 +357,10 @@ def _TTreeAsMatrix(self, columns=None, exclude=None, dtype="double", return_labe
     flat_matrix = _root.std.vector(dtype)(self.GetEntries()*len(columns))
 
     # Read the tree as flat std.vector(dtype)
-    tree_ptr = _root.ROOT.Detail.RDF.GetAddress(self)
-    columns_vector_ptr = _root.ROOT.Detail.RDF.GetAddress(columns_vector)
-    flat_matrix_ptr = _root.ROOT.Detail.RDF.GetVectorAddress(dtype)(flat_matrix)
-    jit_code = "ROOT::Detail::RDF::TTreeAsFlatMatrixHelper<{dtype}, {col_dtypes}>(*reinterpret_cast<TTree*>({tree_ptr}), *reinterpret_cast<std::vector<{dtype}>* >({flat_matrix_ptr}), *reinterpret_cast<std::vector<string>* >({columns_vector_ptr}));".format(
+    tree_ptr = _root.ROOT.Internal.RDF.GetAddress(self)
+    columns_vector_ptr = _root.ROOT.Internal.RDF.GetAddress(columns_vector)
+    flat_matrix_ptr = _root.ROOT.Internal.RDF.GetVectorAddress(dtype)(flat_matrix)
+    jit_code = "ROOT::Internal::RDF::TTreeAsFlatMatrixHelper<{dtype}, {col_dtypes}>(*reinterpret_cast<TTree*>({tree_ptr}), *reinterpret_cast<std::vector<{dtype}>* >({flat_matrix_ptr}), *reinterpret_cast<std::vector<string>* >({columns_vector_ptr}));".format(
             col_dtypes = ", ".join(col_dtypes),
             dtype = dtype,
             tree_ptr = tree_ptr,
diff --git a/tree/dataframe/CMakeLists.txt b/tree/dataframe/CMakeLists.txt
index 84c60d3a815f80abddcf4026dd745834dbf052af..40b2a75400dd44c969ef067c1d89f61e2f25c12b 100644
--- a/tree/dataframe/CMakeLists.txt
+++ b/tree/dataframe/CMakeLists.txt
@@ -55,7 +55,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(ROOTDataFrame
     ROOT/RDF/RRange.hxx
     ROOT/RDF/RSlotStack.hxx
     ROOT/RDF/Utils.hxx
-    ROOT/RDF/TTreeAsFlatMatrix.hxx
+    ROOT/RDF/PyROOTHelpers.hxx
     ${RDATAFRAME_EXTRA_HEADERS}
   SOURCES
     src/RActionBase.cxx
diff --git a/tree/dataframe/inc/ROOT/RDF/TTreeAsFlatMatrix.hxx b/tree/dataframe/inc/ROOT/RDF/PyROOTHelpers.hxx
similarity index 95%
rename from tree/dataframe/inc/ROOT/RDF/TTreeAsFlatMatrix.hxx
rename to tree/dataframe/inc/ROOT/RDF/PyROOTHelpers.hxx
index f307ca3fedd463d725828862bfeab7ea117abedb..5a90fa79fe7912b6cda023d66fe028fed097b853 100644
--- a/tree/dataframe/inc/ROOT/RDF/TTreeAsFlatMatrix.hxx
+++ b/tree/dataframe/inc/ROOT/RDF/PyROOTHelpers.hxx
@@ -8,8 +8,8 @@
  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
  *************************************************************************/
 
-#ifndef ROOT_TTreeAsFlatMatrix
-#define ROOT_TTreeAsFlatMatrix
+#ifndef ROOT_PyROOTHelpers
+#define ROOT_PyROOTHelpers
 
 #include "ROOT/RDataFrame.hxx"
 
@@ -18,7 +18,7 @@
 #include <utility>
 
 namespace ROOT {
-namespace Detail {
+namespace Internal {
 namespace RDF {
 
 template <typename dtype>
@@ -61,7 +61,7 @@ void TTreeAsFlatMatrixHelper(TTree &tree, std::vector<BufType> &matrix, std::vec
 }
 
 } // namespace RDF
-} // namespace Detail
+} // namespace Internal
 } // namespace ROOT
 
 #endif