Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display <IPython.core.display.HTML object>?

I try to run the below codes but I have a problem in showing the results. also, I use pycharm IDE.

from fastai.text import *

data = pd.read_csv("data_elonmusk.csv",  encoding='latin1')
data.head()

data = (TextList.from_df(data, cols='Tweet')
                .split_by_rand_pct(0.1)
                .label_for_lm()
                .databunch(bs=48))

data.show_batch()

The output while I run the line "data.show_batch()" is:

IPython.core.display.HTML object
like image 760
Siamak Abdi Avatar asked Sep 11 '19 06:09

Siamak Abdi


People also ask

What is IPython display in Python?

IPython (Interactive Python) is a command shell for interactive computing in multiple programming languages, originally developed for the Python programming language, that offers introspection, rich media, shell syntax, tab completion, and history.

What is from IPython display import Clear_output?

You can use IPython. display. clear_output to clear the output of a cell.


1 Answers

You can only render HTML in a browser and not in a Python console/editor environment.

Hence it works in Jupiter notebook, Jupyter Lab, etc.

At best you call .data to see HTML, but again it will not render.

like image 160
Arpit-Gole Avatar answered Sep 16 '22 16:09

Arpit-Gole