TableImporter creates an empty dataframe when obligatory_columns is empty

Summary

When using the TableImporter to read in a csv file (TODO: Is this valid for other importer classes than CSVImporter?) I noticed that it will always return an empty dataframe if there is no obligatory column provided.

Expected Behavior

The complete dataframe should be provided without any check.

Actual Behavior

It is empty.

Steps to Reproduce the Problem

Take any CSV, e.g.

int_column,float_column
1,1.0
2,
3,1.2

and try to import it via

from caosadvancedtools.table_importer import CSVImporter

csv_importer = CSVImporter(converters={}, datatypes={"int_column": int, "float_column": float})
csv_importer.read_file("test.csv")  # returns an empty dataframe

Compare the output to

csv_importer = CSVImporter(converters={}, datatypes={"int_column": int, "float_column": float}, obligatory_columns=["int_column"])
csv_importer.read_file("test.csv")  # returns the complete dataframe

Specifications

  • Version: caosadvancedtools 0.10.0 (Linkahead 0.13)
  • Platform: Any

Possible fixes

Only check obligatories if there is a non-empty list.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information