# Root files to csv Missing Values

**URL:** <https://root-forum.cern.ch/t/root-files-to-csv-missing-values/33431>\
**Category:** Newbie\
**Created:** [April 3, 2019, 2:35am UTC](https://root-forum.cern.ch/t/root-files-to-csv-missing-values/33431 "2019-04-03T02:35:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ANDRES\_MENDEZ](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@ANDRES\_MENDEZ](https://root-forum.cern.ch/u/ANDRES_MENDEZ)\
**Post date:** [April 3, 2019, 2:35am UTC](https://root-forum.cern.ch/t/root-files-to-csv-missing-values/33431/1 "2019-04-03T02:35:51Z")

</div>

I am trying to write a csv file from a root file. However, for variables like the energy of leptons, root produce a vector for such events, which of course, might differ in size depending on the number of leptons produced by my process. My goal is to write something like a dataframe (rows x columns) to implement another code i have in python. However, I must specify the columns. In my case I decided to write only 4 columns for the energy of the leptons. And save only the 4 biggest values that appear in the root file. My question is, what happens with those columns when an event has only 1 lepton? Should I fill the entries of the other three columns with NaN values, 0s, or set -9999 ?

I’m a little bit confuse with this cause if I put -9999 or something similar, it migjt affect some of my statistical variables (?), if I put zero I will have a large number of events with 0 energy for the subleptons for example, and if I put NaN some functions might crash.

Any advise?

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [April 3, 2019, 7:19am UTC](https://root-forum.cern.ch/t/root-files-to-csv-missing-values/33431/2 "2019-04-03T07:19:13Z")

</div>

Hi,

the usage of a special value that you have to treat in your python code is a choice.  
Another one would be to have a column with the size of the collection and another column with the value themsleves saved as comma separated list.

Cheers,  
D
