{
"cells": [
{
"cell_type": "markdown",
"id": "bb468125",
"metadata": {},
"source": [
"# df024_Display\n",
"Use the Display action to inspect entry values.\n",
"\n",
"\n",
"\n",
"\n",
"**Author:** Enrico Guiraud, Danilo Piparo, Enric Tejedor Saavedra (CERN), Massimo Tumolo (Politecnico di Torino) \n",
"This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, May 19, 2026 at 08:09 PM."
]
},
{
"cell_type": "markdown",
"id": "ee063389",
"metadata": {},
"source": [
"Setting up a Dataframe with some data"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "01b8cd12",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:09:58.536972Z",
"iopub.status.busy": "2026-05-19T20:09:58.536843Z",
"iopub.status.idle": "2026-05-19T20:09:59.453104Z",
"shell.execute_reply": "2026-05-19T20:09:59.452744Z"
}
},
"outputs": [],
"source": [
"unsigned long long y = 1;\n",
"int x = 1;\n",
"double w = 1;\n",
"double z = 1;\n",
"ROOT::RDataFrame df(10);\n",
"auto d = df.Define(\"y\", [&y]() { return y *= 100; }) // A column with ulongs\n",
" .Define(\"x\",\n",
" [&x]() {\n",
" return std::vector({x++, x++, x++, x++});\n",
" }) // A column with four-elements collection\n",
" .Define(\"w\", [&w]() { return w *= 1.8; }) // A column with doubles\n",
" .Define(\"z\", [&z]() {\n",
" z *= 1.1;\n",
" return std::vector>({{z, ++z}, {z, ++z}, {z, ++z}});\n",
" }); // A column of matrices"
]
},
{
"cell_type": "markdown",
"id": "c04699c6",
"metadata": {},
"source": [
"Preparing the RResultPtr object with all columns and default number of entries"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "7da1979c",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:09:59.456080Z",
"iopub.status.busy": "2026-05-19T20:09:59.455968Z",
"iopub.status.idle": "2026-05-19T20:09:59.741531Z",
"shell.execute_reply": "2026-05-19T20:09:59.740878Z"
}
},
"outputs": [],
"source": [
"auto d1 = d.Display(\"\");"
]
},
{
"cell_type": "markdown",
"id": "63ca37f1",
"metadata": {},
"source": [
"Preparing the RResultPtr object with two columns and default number of entries"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "b5d0fcfa",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:09:59.744269Z",
"iopub.status.busy": "2026-05-19T20:09:59.744154Z",
"iopub.status.idle": "2026-05-19T20:09:59.946530Z",
"shell.execute_reply": "2026-05-19T20:09:59.946159Z"
}
},
"outputs": [],
"source": [
"auto d2 = d.Display({\"x\", \"y\"});"
]
},
{
"cell_type": "markdown",
"id": "7e158be1",
"metadata": {},
"source": [
"Printing the short representations, the event loop will run"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "6b7dc10b",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:09:59.949283Z",
"iopub.status.busy": "2026-05-19T20:09:59.949167Z",
"iopub.status.idle": "2026-05-19T20:10:01.289835Z",
"shell.execute_reply": "2026-05-19T20:10:01.289518Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The following is the representation of all columns with the default nr of entries\n",
"+-----+-----------+----+-------------+--------------------------+\n",
"| Row | w | x | y | z | \n",
"+-----+-----------+----+-------------+--------------------------+\n",
"| 0 | 1.800000 | 1 | 100 | { 1.1000000, 2.1000000 } | \n",
"| | | 2 | | { 2.1000000, 3.1000000 } | \n",
"| | | 3 | | { 3.1000000, 4.1000000 } | \n",
"| | | 4 | | | \n",
"+-----+-----------+----+-------------+--------------------------+\n",
"| 1 | 3.240000 | 5 | 10000 | { 4.5100000, 5.5100000 } | \n",
"| | | 6 | | { 5.5100000, 6.5100000 } | \n",
"| | | 7 | | { 6.5100000, 7.5100000 } | \n",
"| | | 8 | | | \n",
"+-----+-----------+----+-------------+--------------------------+\n",
"| 2 | 5.832000 | 9 | 1000000 | { 8.2610000, 9.2610000 } | \n",
"| | | 10 | | { 9.2610000, 10.261000 } | \n",
"| | | 11 | | { 10.261000, 11.261000 } | \n",
"| | | 12 | | | \n",
"+-----+-----------+----+-------------+--------------------------+\n",
"| 3 | 10.497600 | 13 | 100000000 | { 12.387100, 13.387100 } | \n",
"| | | 14 | | { 13.387100, 14.387100 } | \n",
"| | | 15 | | { 14.387100, 15.387100 } | \n",
"| | | 16 | | | \n",
"+-----+-----------+----+-------------+--------------------------+\n",
"| 4 | 18.895680 | 17 | 10000000000 | { 16.925810, 17.925810 } | \n",
"| | | 18 | | { 17.925810, 18.925810 } | \n",
"| | | 19 | | { 18.925810, 19.925810 } | \n",
"| | | 20 | | | \n",
"+-----+-----------+----+-------------+--------------------------+\n",
"\n",
"\n",
"The following is the representation of two columns with the default nr of entries\n",
"+-----+----+-------------+\n",
"| Row | x | y | \n",
"+-----+----+-------------+\n",
"| 0 | 1 | 100 | \n",
"| | 2 | | \n",
"| | 3 | | \n",
"| | 4 | | \n",
"+-----+----+-------------+\n",
"| 1 | 5 | 10000 | \n",
"| | 6 | | \n",
"| | 7 | | \n",
"| | 8 | | \n",
"+-----+----+-------------+\n",
"| 2 | 9 | 1000000 | \n",
"| | 10 | | \n",
"| | 11 | | \n",
"| | 12 | | \n",
"+-----+----+-------------+\n",
"| 3 | 13 | 100000000 | \n",
"| | 14 | | \n",
"| | 15 | | \n",
"| | 16 | | \n",
"+-----+----+-------------+\n",
"| 4 | 17 | 10000000000 | \n",
"| | 18 | | \n",
"| | 19 | | \n",
"| | 20 | | \n",
"+-----+----+-------------+\n"
]
}
],
"source": [
"std::cout << \"The following is the representation of all columns with the default nr of entries\" << std::endl;\n",
"d1->Print();\n",
"std::cout << \"\\n\\nThe following is the representation of two columns with the default nr of entries\" << std::endl;\n",
"d2->Print();"
]
},
{
"cell_type": "markdown",
"id": "b543dd8a",
"metadata": {},
"source": [
"Draw all canvases "
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "582fb433",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:10:01.300511Z",
"iopub.status.busy": "2026-05-19T20:10:01.300379Z",
"iopub.status.idle": "2026-05-19T20:10:01.513732Z",
"shell.execute_reply": "2026-05-19T20:10:01.509817Z"
}
},
"outputs": [],
"source": [
"gROOT->GetListOfCanvases()->Draw()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "ROOT C++",
"language": "c++",
"name": "root"
},
"language_info": {
"codemirror_mode": "text/x-c++src",
"file_extension": ".C",
"mimetype": " text/x-c++src",
"name": "c++"
}
},
"nbformat": 4,
"nbformat_minor": 5
}