【发布时间】:2021-11-02 04:29:49
【问题描述】:
我在获取数据时遇到问题。 我有这个数据框:
我需要按 'fabricante' == 'Kellogs' 过滤并获得 'calorias' 列,我这样做了:
我需要在这个函数中引入第二列(卡路里):
def valor_medio_intervalo(fabricante, variable, confianza):
subconjunto = None # Select only the data: (fabricante, variable) from 'cereal_df'
inicio, final = None, None # put the statistical function here.
return inicio, final
这是我最后一部分的代码:
def valor_medio_intervalo(fabricante, variable, confianza):
subconjunto = cereal_df.loc[cereal_df['fabricante'] == fabricante][variable]
inicio, final = sm.stats.DescrStatsW(variable).tconfint_mean(alpha = 1-confianza)
return inicio, final
错误:
如果你能帮助我,我会非常感激
【问题讨论】:
标签: python arrays pandas statistics