小编red*_*ire的帖子

Altair 数据聚合

我试图在 Altair 上绘制以下内容: x = 每日时间戳 y = 记录数,因为数据是名义数据而不是定量数据

当我尝试按月或季度汇总 x 时,是否可以将 y 显示为每天的平均记录数而不是总和?

chart = alt.Chart(data).mark_bar().encode(
    x = alt.X('Date:T'),
    y = alt.Y('count(Name):Q'),
    color = alt.Color('descriptor:N')
)
chart
Run Code Online (Sandbox Code Playgroud)

当我尝试做的时候

chart = alt.Chart(data).mark_bar().encode(
    x = alt.X('month(Date):T'),
    y = alt.Y('count(Name):Q'),
    color = alt.Color('descriptor:N')
)
chart
Run Code Online (Sandbox Code Playgroud)

它按月总数汇总,是否可以计算每月计数的平均值?

python charts altair

4
推荐指数
1
解决办法
2938
查看次数

标签 统计

altair ×1

charts ×1

python ×1