Skip to content

csv: Fix reading empty columns as float

Tjerk Vreeken requested to merge csv-fix-emtpy-column-read-nan-try-2 into master

We use np.genfromtxt with dtype=None, which means that it will guess. If a column does not have any value specified, it will guess the dtype boolean with values False. This would eventually be turned into a Timeseries of 0.0. We however want a Timeseries full of np.nan.

It is difficult to make np.genfromtxt read in floats, when the first column can sometimes be a string. Therefore, we detect the case where the dtype of a column is boolean, and force a conversion to float. Basically, we therefore only support reading in floats (and a optionally string for the first column).

Closes #1128 (closed)

Merge request reports