示例代码
import streamlit as st import pandas as pd from pathlib import Path@st.cache_data def load_data_from_csv(file_path):return pd.read_csv(file_path)if __name__ == '__main__':file_path = Path(__file__).parent.parent / 'resources' / 'data.csv'data = load_data_from_csv(file_path)st.write(data)
执行方式: