使用 streamlit.write(df) 时文本被截断。

huangapple go评论71阅读模式
英文:

Text gets truncated while using streamlit.write(df)

问题

我使用streamlit.write(df)函数来显示一个DataFrame,但文本没有完全显示,以下是情况的简要示例。

import pandas as pd
import streamlit as st

df = pd.DataFrame({'col1': [1, 2, 3], 'col2': ['这是一些文本,文本很长,无法完全显示,需要添加换行或其他内容。', '简短的文本', '另一段文本。']})
st.write(df)

这是输出结果,理想情况下应该添加换行,但对我来说没有起作用。

使用 streamlit.write(df) 时文本被截断。

英文:

I'm using the function streamlit.write(df) to display a df, but the text is not fully displayed, here is a short example of the situation.

import pandas as pd
import streamlit as st

df = pd.DataFrame({'col1': [1, 2, 3], 'col2': ['This is some text large text that will not be 
                  completely displayed, need to add break lines or something.', 'short text', 
                  'another piece of text.']})
st.write(df))

This is the output, the ideal thing is to add line breaks, but did not work for me.

使用 streamlit.write(df) 时文本被截断。

答案1

得分: 1

你可以使用表格

st.table(df)
英文:

You can use table

st.table(df)

huangapple
  • 本文由 发表于 2023年2月16日 19:12:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/75471430.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定