개발/대시보드

웹대시보드 - 데이터프레임을 읽어 streamlit 으로 출력

웅'jk 2022. 12. 12. 17:20
# 판다스의 데이터프레임을, 웹화면으로 보여주는 방법

import streamlit as st
import pandas as pd


def main() :
    st.title('아이리스 꽃 데이터')
    
    df = pd.read_csv('streamlit_data/iris.csv')
    
    st.dataframe(df)
    species = df['species'].unique()

    st.text('아이리스 꽃은 '+species + '으로 되어있다.')

if __name__ == '__main__' :
    main()

위 코드처럼 streamlit 에 dataframe() 으로 읽어올수있다.