# RDataFrame built from string branches

**URL:** <https://root-forum.cern.ch/t/rdataframe-built-from-string-branches/49132>\
**Category:** ROOT\
**Tags:** rdataframe\
**Created:** [March 11, 2022, 12:20am UTC](https://root-forum.cern.ch/t/rdataframe-built-from-string-branches/49132 "2022-03-11T00:20:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfrances](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/ea666f/32.png) [@sfrances](https://root-forum.cern.ch/u/sfrances)\
**Post date:** [March 11, 2022, 12:20am UTC](https://root-forum.cern.ch/t/rdataframe-built-from-string-branches/49132/1 "2022-03-11T00:20:17Z")

</div>

Hello,

I am loading a TTree which has strings for all branches ("/C") in an RDataFrame.  
I noticed that actually the column type is ‘ROOT::VecOps::RVec\<Char\_t\>’.

Probably this is causing the several issues that I see:

- Filters like df.Filter(‘var == “blabla”’) failing
- df.Display(“var”, 10).Print() in python working but appending symbols like “$??\*” at the end
- df.Display(“var”, 10)-\>Print() in C++ complaining about missing shared libraries

The issue could be actually due to the branch type ("/C" instead of “std::string”)? Or do I really need to cast the ‘ROOT::VecOps::RVec\<Char\_t\>’ objects to string for any action? Is the behaviour expected?

Thank you,  
Simone

* * *

_ROOT Version:_ 6.24.06  
_Platform:_ Centos7

* * *

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [March 11, 2022, 8:49am UTC](https://root-forum.cern.ch/t/rdataframe-built-from-string-branches/49132/2 "2022-03-11T08:49:23Z")

</div>

I guess @eguiraud or @etejedor can help

---

<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:** [March 11, 2022, 11:02am UTC](https://root-forum.cern.ch/t/rdataframe-built-from-string-branches/49132/3 "2022-03-11T11:02:38Z")

</div>

Hi @sfrances ,

> [@sfrances](#):
>
> I noticed that actually the column type is ‘ROOT::VecOps::RVec\<Char\_t\>’.
> 
> Probably this is causing the several issues that I see:

> [@sfrances](#):
>
> The issue could be actually due to the branch type (“/C” instead of “std::string”)?

Yes to all of the above 🙂 In general RDF represents C-style arrays as RVecs (including C-style arrays of characters). If the column type was `std::string` then RDF would read it as a `std::string`.

The simplest workaround in v6.26 is a `df.Redefine("var", "std::string(var.data(), var.size())")` or an equivalent `Define` in v6.24.

I hope this helps!  
Enrico

---

<div class="post-metadata">

**Author:** ![sfrances](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/ea666f/32.png) [@sfrances](https://root-forum.cern.ch/u/sfrances)\
**Post date:** [March 11, 2022, 11:16am UTC](https://root-forum.cern.ch/t/rdataframe-built-from-string-branches/49132/4 "2022-03-11T11:16:38Z")

</div>

Thank you so much for the clarification. I assumed at first that I was doing something illegal, so I asked. Perfectly understood!

Ciao,  
Simone

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [March 25, 2022, 11:16am UTC](https://root-forum.cern.ch/t/rdataframe-built-from-string-branches/49132/5 "2022-03-25T11:16:54Z")

</div>

Closed on March 25, 2022, 11:16am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
