Skip to content

Testing for duplicate metadata columns #333

Description

@wlason

This may seem silly, but if the user specifies the same column name twice in the ingest yaml, the error is not intuitive:

 Traceback (most recent call last): \
                                                  File "/panpipes/panpipes/python_scripts/concat_adata.py", line 141, in <module> \
                                                    mdata.update_obs() \
                                                  File "/envs/panpipes/lib/python3.10/site-packages/mudata/_core/mudata.py", line 1429, in update_obs \
                                                    self._update_attr("obs", axis=1, join_common=join_common) \
                                                  File "/envs/panpipes/lib/python3.10/site-packages/mudata/_core/mudata.py", line 579, in _update_attr \
                                                    self._update_attr_legacy(attr, axis, join_common, **kwargs) \
                                                  File "/envs/panpipes/lib/python3.10/site-packages/mudata/_core/mudata.py", line 989, in _update_attr_legacy \
                                                    [ \
                                                  File "/envs/panpipes/lib/python3.10/site-packages/mudata/_core/mudata.py", line 990, in <listcomp> \
                                                    _maybe_coerce_to_boolean( \
                                                  File "/envs/panpipes/lib/python3.10/site-packages/mudata/_core/utils.py", line 35, in _maybe_coerce_to_boolean \
                                                    if df[col].dtype == bool: \
                                                  File "/well/jknight-hinks/users/lwn344/conda/skylake/envs/panpipes/lib/python3.10/site-packages/pandas/core/generic.py", line 5902, in __getattr__ \
                                                    return object.__getattribute__(self, name) \
                                                AttributeError: 'DataFrame' object has no attribute 'dtype'. Did you mean: 'dtypes'? \

Maybe it would be worth adding a check that the column names are unique?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions