On Mon, Aug 26, 2024 at 7:00 AM Artur T. <atecon(a)posteo.de> wrote:
I stumbled over an issue in case a dataset has no values for the last k
columns.
The dataset which I want to open has the following format:
A B C D
1 4
2
3
As can be seen, the last two columns have a header, but all rows are
missing.
For a csv file all four columns get imported as series, respectively.
However, for ods- or xlsx-files only the first two columns are imported
but not columns C and D. I could not find any hint in the help file.
For both ods and xlsx files, the terminal prints the message "Sheet has
2 trailing empty variables"
Can anybody explain this to me, please? Or is this a bug?
It's not a bug. You can take a look at the function
import_prune_columns(), at
https://sourceforge.net/p/gretl/git/ci/master/tree/plugin/import_common.c
, which shows this is a deliberate policy. However, there is an
inconsistency in that we don't apply that policy to plain CSV input
(which is handled in the main body of libgretl, not via a plugin).
I guess the history of this is that at one point I noticed some
spreadsheet imports with lots of empty trailing columns, but didn't
see examples of that sort in plain CSV. If it's important to make the
behavior consistent, my inclination would be to apply
import_prune_columns() to CSV files. In principle a file might contain
many such empty columns, eating up memory uselessly.
Allin