CAFE

2.파이썬 수업

평균 그래프

작성자유연수|작성시간23.01.20|조회수55 목록 댓글 0
import altair as alt
from vega_datasets import data
import  streamlit   as   st 

source = data.wheat()

bar = alt.Chart(source).mark_bar().encode(
    x='year:O',
    y='wheat:Q'
)

line = alt.Chart(source).mark_line(color='red').transform_window(
    # The field to average
    rolling_mean='mean(wheat)',
    # The number of values before and after the current value to include.
    frame=[-9, 0]
).encode(
    x='year:O',
    y='rolling_mean:Q'
)

a= (bar + line).properties(width=600)
st.altair_chart(a, use_container_width=True)




다음검색
현재 게시글 추가 기능 열기

댓글

댓글 리스트
맨위로

카페 검색

카페 검색어 입력폼