[英]In Jupyter, do you do a running update (hide) a pandas table as you are updating it?
In Jupyter, I am running a long-running computation.在 Jupyter 中,我正在运行一个长时间运行的计算。
I want to show a Pandas table with the top 25 rows.我想展示一个前 25 行的 Pandas 表。 The top 25 may update each iteration.
前 25 名可能会在每次迭代中更新。
However, I don't want to show many Pandas tables.但是,我不想展示很多Pandas 表。 I want to delete / update the existing displayed Pandas table.
我想删除/更新现有显示的 Pandas 表。
How is this possible?这怎么可能?
This approach seems usable for matplotlibs but not pandas pretty tables. 这种方法似乎适用于 matplotlibs,但不适用于 pandas 漂亮的表格。
You can use clear_output
and display
the dataframe:您可以使用
clear_output
并display
dataframe:
from IPython.display import display, clear_output
# this is just to simulate the delay
import time
i = 1
while i<10:
time.sleep(1)
df = pd.DataFrame(np.random.rand(4,3))
clear_output(wait=True)
display(df)
i += 1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.