我试图在 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)
它按月总数汇总,是否可以计算每月计数的平均值?