G-Node/nixpy

Enforce unique column names for DataFrame (?)

achilleas-k opened this issue · 2 comments

We don't enforce unique column names for DataFrame objects but we do have methods for getting columns by name.

EDIT: Since we use a compound data type to represent DFs and the column names become the name of the member, non-unique members will cause an error at the HDF5 level. We should catch this early.

I am wondering which is the correct exception that should be raised. ValueError?

For objects we have a DuplicateName custom exception.

class DuplicateName(Exception):

We can't use that here since the message isn't appropriate. Let's create a new type of custom Exception for this as well DuplicateColumnName. The message should be something like:
"Column names for a DataFrame have to be unique."