我试图运行以下代码:
from astropy.table import Table
from astroquery.nasa_exoplanet_archive import NasaExoplanetArchive
exoplanets = NasaExoplanetArchive.get_confirmed_planets_table()
df=exoplanets.group_by('pl_orbsmax')
print(df)并得到错误:
NotImplementedError:对混合列的表不可用的group_by
我只想根据特定列中的条目提取数据。如何将此表转换为可以使用"group_by“的格式?
我试图将列限制在少数几个,我很确定这些列不是混在一起的。
subset=exoplanets['pl_discmethod','pl_orbsmax', 'pl_bmassj', 'st_mass']但也有同样的错误。我试着转换成熊猫,但这也不起作用。
发布于 2019-01-02 15:46:28
混合列的分组在3.1中实现:
In [3]: t = Table([[1,2], Time([1,2], format='cxcsec')], names=['x', 'time'])
In [4]: tg = t.group_by('x')
In [5]: tg.groups[1]
Out[5]:
<Table length=1>
x time
int64 object
----- ----------------
2 2.00000000000351顺便说一下,您可以确定地检查具有has_mixin_columns属性的mixin列:
In [7]: t.has_mixin_columns
Out[7]: Truehttps://stackoverflow.com/questions/54000694
复制相似问题