In Jupyter, I am running a long-running computation.
I want to show a Pandas table with the top 25 rows. The top 25 may update each iteration.
However, I don't want to show many Pandas tables. I want to delete / update the existing displayed Pandas table.
How is this possible?
This approach seems usable for matplotlibs but not pandas pretty tables.
You can use clear_output
and display
the 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.