我在更新astropy后遇到了一些独特功能问题
代码:
from astropy.table import Table
import numpy as np
table = Table(data=[[1,2,3,2,3,3],[2,3,4,5,4,6],[3,4,5,6,7,8]],
names=['col1', 'col2', 'col3'],
dtype=[np.int32, np.int32, np.int32])
unique(table, keys='col1')
jupyter笔记本中的错误
NameError: name 'unique' is not defined
终端错误
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'unique' is not defined
我该怎么办?
答案 0 :(得分:1)
您必须从astropy.table
from astropy.table import unique
example in the documentation(您在问题中使用的)不正确。
同一文档页面中的函数签名清楚地表明了它的来源:
astropy.table.unique(input_table, keys=None, silent=False, keep='first')