스트림릿의 내장 차트 함수를 사용한다.
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
def main():
# 스트림릿에서 제공해주는 차트
# line_chart, area_chart
df1 = pd.read_csv('./data/lang_data.csv')
column_list = df1.columns[1:]
choice_list = st.multiselect('언어를 선택하세요', column_list)
print(choice_list)
if len(choice_list) != 0:
df_choice = df1[choice_list]
st.dataframe(df_choice)
st.line_chart(df_choice)
st.area_chart(df_choice)
df2 = pd.read_csv('./data/iris.csv')
# 스트림릿이 제공하는 bar_chart
print(df2.iloc[:,0:-2+1])
df_iris = df2.iloc[:,0:-2+1]
st.bar_chart(df_iris)
# 지도
df3 = pd.read_csv('./data/location.csv', index_col=0)
print(df3)
st.map(df3)
if __name__ == '__main__':
main()
'Python > Streamlit' 카테고리의 다른 글
[Python] Streamlit jupyter notebook에서 학습한 인공지능을 스트림릿에서 사용하는 방법 (0) | 2024.04.25 |
---|---|
[Python] Streamlit plotly 차트 (1) | 2024.04.24 |
[Python] Streamlit matplotlib, seaborn 차트 (1) | 2024.04.24 |
[Python] Streamlit 파일 분리 처리 (0) | 2024.04.24 |
[Python] Streamlit 파일 업로드 (0) | 2024.04.24 |