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 (

  • 24
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

此星光明

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值