I have a TAP table in a VO service that I want to dump to csv. So for this I basically was thinking of
using the following code snippet (replaced the VO service by a public one for demonstration purposes):
=========8<========
import pyvo
tapurl = ‘Information on Service 'The VO @ ASTRON TAP service'’
qry= “select * from tgssadr.img_main”
tap_service = pyvo.dal.TAPService(tapurl)
tap_result = tap_service.run_sync(qry)
tbl = tap_result.to_table()
tbl.write(“my.csv”)
=========8<========
However the last command returns:
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python3.9/site-packages/astropy/table/connect.py”, line 127, in call
registry.write(instance, *args, **kwargs)
File “/usr/local/lib/python3.9/site-packages/astropy/io/registry.py”, line 570, in write
writer(data, *args, **kwargs)
File “/usr/local/lib/python3.9/site-packages/astropy/io/ascii/connect.py”, line 26, in io_write
return write(table, filename, **kwargs)
File “/usr/local/lib/python3.9/site-packages/astropy/io/ascii/ui.py”, line 842, in write
writer.write(table, output)
File “/usr/local/lib/python3.9/site-packages/astropy/io/ascii/fastbasic.py”, line 207, in write
self._write(table, output, {‘fill_values’: [(core.masked, ‘’)]})
File “/usr/local/lib/python3.9/site-packages/astropy/io/ascii/fastbasic.py”, line 184, in _write
writer.write(output, header_output, output_types)
File “astropy/io/ascii/cparser.pyx”, line 1125, in astropy.io.ascii.cparser.FastWriter.write
TypeError: unhashable type: ‘MaskedArray’
This confuses me because first of all, the Table is not masked (tbl.masked is set to False). I guess this may be a bug but I don’t really know if this is an issue with pyvo or astropy.Table . Hopefully the crowd has seen this issue before, or can indicate me another way to do this.