These are chat archives for astropy/astropy

Jun 2016
Joseph Long
Jun 27 2016 18:49
Hi all, can anyone tell me the right way to rename a column in a FITS table?
(Assuming there's a simpler way than rebuilding the table and creating a new column for the renamed stuff)
Ooh, if I open as an astropy.table.Table I have a rename_column
Megan Sosey
Jun 27 2016 20:05
@josePhoenix You can open the table in edit mode, then change the value of the column name, which is the TTYPEx where x is the column. So something like:,mode='update') followed by a[0].header['ttype1']='MYNAME' to change the name of column 1, dont forget to change the type as well if needed. Then close the data file and it should be updated. I think this is a valid method.
@josePhoenix oops - make sure the extension header your editing is the one that has the column, not the global necessarily, sorry just caught that