개발공부

[Streamlit] Dataframe 출력하기 본문

Python/Streamlit

[Streamlit] Dataframe 출력하기

mscha 2022. 5. 20. 17:33

streamlit의 dataframe() 함수를 이용하면 된다.

import streamlit as st
import pandas as pd

def main():
    df = pd.read_csv('data2/iris.csv')

    st.dataframe(df)

    species = df['species'].unique()

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

    st.dataframe(df.head())
    # write로 해도 가능
    st.write(df.head())

    


if __name__ == '__main__':
    main()