本文主要是介绍Python应用开发——30天学习Streamlit Python包进行APP的构建(6),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
当我们想在界面上进行数据展示的时候,你就会发现我们需要进行数据交互式的应用开发,这里我们来看看如何实现?
Data elements数据要素
在处理数据时,快速、交互式地从多个不同角度对数据进行可视化是非常有价值的。这就是 Streamlit 的构建和优化目的。
你可以通过图表显示数据,也可以显示原始数据。这些是你可以用来显示原始数据并与之交互的 Streamlit 命令。
本页仅包含有关 st.dataframe API 的信息。有关使用数据帧的概述,请参阅 "数据帧"。如果您想让用户交互式地编辑数据帧,请查看 st.data_editor。
st.dataframe
将数据框显示为交互式表格。
该命令适用于来自 Pandas、PyArrow、Snowpark 和 PySpark 的数据帧。它还能显示其他几种可转换为数据帧的类型,如 numpy 数组、列表、集合和字典。
st.dataframe(data=None, width=None, height=None, *, use_container_width=False, hide_index=None, column_order=None, column_config=None, key=None, on_select="ignore", selection_mode="multi-row") | |
---|---|
Returns | |
(element or dict) | If on_select is "ignore" (default), this method returns an internal placeholder for the dataframe element that can be used with the .add_rows() method. Otherwise, this method returns a dictionary-like object that supports both key and attribute notation. The attributes are described by the DataframeState dictionary schema. |
Parameters | |
data (pandas.DataFrame, pandas.Series, pandas.Styler, pandas.Index, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None) | The data to display. If data is a pandas.Styler, it will be used to style its underlying pandas.DataFrame. Streamlit supports custom cell values and colors. It does not support some of the more exotic pandas styling features, like bar charts, hovering, and captions. |
width (int or None) | Desired width of the dataframe expressed in pixels. If width is None (default), Streamlit sets the dataframe width to fit its contents up to the width of the parent container. If width is greater than the width of the parent container, Streamlit sets the dataframe width to match the width of the parent container. |
height (int or None) | Desired height of the dataframe expressed in pixels. If height is None (default), Streamlit sets the height to show at most ten rows. Vertical scrolling within the dataframe element is enabled when the height does not accomodate all rows. |
use_container_width (bool) | Whether to override width with the width of the parent container. If use_container_width is False ( |
这篇关于Python应用开发——30天学习Streamlit Python包进行APP的构建(6)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!