I tried to read in a csv file using:
auto tdf = ROOT::RDF::MakeCsvDataFrame("data.csv"); but it did not work. I looked around and it seems that RDataFrame cannot exponential formated data from a csv file, i.e. 1.3e6, 1.4e4,1e4 is read in as three strings instead of three doubles.
Is that right and is someone working on this issue?
Thanks a lot!
ROOT Version: 6.14.04
this must be a glitch in the type inference mechanism. We will fix it. Can you share the input file to be sure your usecase is addressed?
Thanks for reporting.
The first lines of my inputfile are:
while we implement and backport the fix, you can convert the csv to an equivalent one which will be processed by the csv source.
The python snippet to do this is the following:
lines = open(sys.argv).readlines()
for line in lines[1:]:
sci_numbers = line[:-1].split(',')
numbers = map(lambda x : "%.8f" %x, map(float, sci_numbers))
the invocation is
python convert.py myoriginal.csv >& converted.csv
The csv you pasted in the previous post contains perhaps a typo, i.e.
0.9e.5: could it be
I hope this unblocks you.
Just to add on the complete answer of Danilo, I confirm that we currently do not support exponent syntax for the double type. For the record these are the current regexes:
Thank you very much for your python script!
And indeed there was a typo in this specific file header I choose as example for your.
Thanks a lot for improving the root experience!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.