# Setting default value for column of type Char\_t

**URL:** <https://root-forum.cern.ch/t/setting-default-value-for-column-of-type-char-t/64693>\
**Category:** Newbie\
**Tags:** rdataframe, python\
**Created:** [February 10, 2026, 7:57pm UTC](https://root-forum.cern.ch/t/setting-default-value-for-column-of-type-char-t/64693 "2026-02-10T19:57:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kahaeuss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/a88e57/32.png) [@kahaeuss](https://root-forum.cern.ch/u/kahaeuss)\
**Post date:** [February 10, 2026, 7:57pm UTC](https://root-forum.cern.ch/t/setting-default-value-for-column-of-type-char-t/64693/1 "2026-02-10T19:57:52Z")

</div>

[B.root](https://root-forum.cern.ch/uploads/short-url/h96XFPtT7eQ2iPo7LcU7ylZ5Cy7.root) (5.3 KB)

[A.root](https://root-forum.cern.ch/uploads/short-url/3wt4cxqDlhjShmDSvBlacpUC0Nq.root) (5.3 KB)

* * *

Hi everyone,

I’m having some problems setting a default value for a column of type Char\_t.  
I have two root files with trees, which I load into a dataframe. The first file contains a branch A of type Char\_t which I interpret as boolean values. The second file is missing this branch, so I’m trying to set a default value that will evaluate to false when I do bool(A).  
I managed setting a default value for a float branch by using ROOT.float(0), but the same approach with ROOT.Char\_t(0) doesn’t work as expected, as the default is set to 48 which evaluates to true. I can work around this by checking explicitly for A==1, but this seems a bit awkward (especially since I cannot set 1 as a default value either), so I was wondering if there is a cleaner solution for this.

```auto
import ROOT
df = ROOT.RDataFrame("tree", ["A.root", "B.root"])
print(df.GetColumnType("A"))
df = df.DefaultValueFor("A", ROOT.Char_t(0))
df = df.Define("passA", "bool(A)")
df.Display(["A", "passA"]).Print()

```

Output:

```auto
Char_t
+-----+----+-------+
| Row | A | passA | 
+-----+----+-------+
| 0 | 0 | false | 
+-----+----+-------+
| 1 | 1 | true | 
+-----+----+-------+
| 2 | 48 | true | 
+-----+----+-------+
| 3 | 48 | true | 
+-----+----+-------+

```

_ROOT Version:_ 6.36.04  
_Platform:_ EL9  
_Compiler:_ gcc14

* * *

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [February 10, 2026, 8:45pm UTC](https://root-forum.cern.ch/t/setting-default-value-for-column-of-type-char-t/64693/2 "2026-02-10T20:45:45Z")

</div>

```auto
import ROOT
df = ROOT.RDataFrame("tree", ["A.root", "B.root"])
print(df.GetColumnType("A"))
df = df.DefaultValueFor("A", ROOT.Char_t('\0'))
df = df.Define("passA", "bool(A)")
df.Display(["A", "passA"]).Print()

```

gives

```auto
Char_t
+-----+---+-------+
| Row | A | passA | 
+-----+---+-------+
| 0 | 0 | false | 
+-----+---+-------+
| 1 | 1 | true | 
+-----+---+-------+
| 2 | 0 | false | 
+-----+---+-------+
| 3 | 0 | false | 
+-----+---+-------+

```
