我正在用AstroPy的Vizier查询包通过Vizier目录搜索天文资源。运行代码后,我返回一个TableList,其中包含目录列表
opticalViz = Vizier(columns=['_RAJ2000', '_DEJ2000','B-V', 'Vmag', 'Bmag'],
keywords = ['optical'])
catalog_list = opticalViz.query_region(coord.SkyCoord('00 57 27.09 -73 25 14.4',
unit=(u.hourangle, u.deg)),
radius = Angle((0,0,6.3), unit = u.deg) )
print(catalog_list)
哪个输出
TableList with 18 tables:
'0:I/221/smc' with 3 column(s) and 1 row(s)
'1:I/252/out' with 4 column(s) and 1 row(s)
'2:I/271/out' with 3 column(s) and 1 row(s)
'3:I/284/out' with 3 column(s) and 1 row(s)
'4:I/297/out' with 4 column(s) and 1 row(s)
'5:I/305/out' with 4 column(s) and 1 row(s)
'6:I/317/sample' with 3 column(s) and 1 row(s)
'7:I/319/xpm' with 4 column(s) and 1 row(s)
'8:I/320/spm4' with 4 column(s) and 1 row(s)
'9:I/322A/out' with 4 column(s) and 1 row(s)
'10:I/337/gaia' with 3 column(s) and 2 row(s)
'11:I/339/hsoy' with 3 column(s) and 1 row(s)
'12:I/345/gaia2' with 3 column(s) and 3 row(s)
'13:II/236/smc' with 4 column(s) and 1 row(s)
'14:II/336/apass9' with 5 column(s) and 1 row(s)
'15:IV/38/tic' with 4 column(s) and 3 row(s)
'16:J/A+A/586/A81/table5' with 5 column(s) and 1 row(s)
'17:J/AJ/123/855/table1' with 4 column(s) and 3 row(s)
这与字典非常相似,键是目录名,值是表。我希望能够按键名称删除特定目录/表。然而,当我尝试使用del catalog_list['I/345/gaia2']
时,我得到一个错误,即列表索引必须是数字
有人能解释什么是表格列表以及如何从中删除特定元素吗
TableLists
是OrderedDict周围的包装。它们在astroquery中用于提供从服务返回的表的最小表示您可以在此处找到更多信息: https://astroquery.readthedocs.io/en/latest/api/astroquery.utils.TableList.html#astroquery.utils.TableList 在这里: https://astroquery.readthedocs.io/en/latest/vizier/vizier.html#query-an-object
但是,您的问题并没有给出任何关于为什么要从列表中删除条目的提示。我不确定TableList是否支持您想要执行的操作。source code可能会有帮助,或者您可能希望在删除条目之前转换为列表或目录表
相关问题 更多 >
编程相关推荐