hdmf
hdmf copied to clipboard
[Bug]: Deprecate the ability to add scalar for a ragged column
What happened?
Currently, you can call table.add_row to add a scalar value to a ragged column. If the scalar is a string, then the characters of the string are broken up and stored as characters in the ragged column. To prevent this and provide a clearer API, add_row should not allow taking a scalar value to a ragged column.
Fixing this would be a breaking change. We should first deprecate the use of table.add_row to add a scalar value to a ragged column.
Steps to Reproduce
from hdmf.common import DynamicTable
dt = DynamicTable(name="test", description="desc")
dt.add_column(name="col1", description="desc", index=True)
dt.add_row(col1="hello") # this should not be allowed. only dt.add_row(col1=["hello"]) should be allowed
dt["col1"][:] # returns [['h', 'e', 'l', 'l', 'o']]
Traceback
No response
Operating System
macOS
Python Executable
Conda
Python Version
3.12
Package Versions
No response