I am working with HDF5 files that have the same data, but newer versions have different Table Field names. Imagine 'col_1' in version 1 is called 'Column_1' in version 2. Same data, different name. (I receive this data downstream from another process, so can't control the names.) I want to do a table.read_where() with a condition that references this column.
I found one way to do it (below):
if version == 1:
arr = dtable.read_where('col_1 == id')
else:
arr = dtable.read_where('Column_1 == id')
In anticipation of future changes, I'd like to use a variable to do the same thing.
Something like this:
if version == 1:
read_col = 'col_1'
else:
read_col = 'Column_1'
# Note: This line does not work as-is:
arr = dtable.read_where( read_col == id )
Is there a way to write this table.read_where() condition with a variable?
If so, I'm missing something.
Thanks.
--Ken