You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VOTable columns= in a different order from the file mixes up BINARY and BINARY2 columns #20512
While trying to fix #8946 with the Gaia VOTable BINARY2 input data described there, and only reading 2 columns, I discovered a bug, where if you give the column names out-of-order from which they appear in the file via columns=, then you get the data swapped between columns. It puts each column's values into another column.
Tables stored as TABLEDATA read correctly, so this is just problem with the BINARY and BINARY2 readers.
The example at the top of issue #8946, columns=['phot_g_mean_mag', 'parallax'], is affected - it returns the parallax values under phot_g_mean_mag, and vice-versa.
Expected behavior
Each column holds its own, correct values, whatever order columns lists them in.
Column a should have 1.0 and 2.0, as it does with tabledata_format="tabledata". The result has the selected columns in file order, but the BINARY reader fills them in the order columns lists them.
Two related failures with BINARY and BINARY2:
If the columns have different dtypes, say string and float, you get ValueError: could not convert string to float: 'x'
And if you list a column twice (probably a mistake, but you never know) columns=["a", "a"], you get IndexError: list assignment index out of range. Should have a better error message.
This bug is in the released astropy 7.0 but not earlier.
So listing the same column twice has always worked fine in astropy for TABLEDATA format. It has always returned the column once. It is only broke for BINARY and BINARY2 since astropy7.
Activity
jdavies-st commentedon Oct 9, 2026
So listing the same column twice has always worked fine in astropy for TABLEDATA format. It has always returned the column once. It is only broke for BINARY and BINARY2 since astropy7.
The following currently works:
And it is only
table_format="binary"ortable_format="binary2"where it currently raises.