How to print as jupyter memory cell output for laptop

I had a problem when printing pandas data in a jupyter laptop. If the column names are really long, it breaks the data structure in different rows.

How can I print it, how does the jupyter laptop do it by default (displayed in the image is the third cell)? As far as I know, the only way to print a data frame in the style of a frame with tables is to leave the variable name with the last command of the notebooks cell.

enter image description here

Here is the code, if you want to check it,

d = pd.DataFrame({'A1_column':[1, 2, 4], 'B1_column':['a', 'b', 'd'], 'A2_column':[1, 2, 4], 'B2_column':['a', 'b', 'd'], 'A3_column':[1, 2, 4], 'B3_column':['a', 'b', 'd'], 'A4_column':[1, 2, 4], 'B4_column':['a', 'b', 'd'], 'A5_column':[1, 2, 4], 'B5_column':['a', 'b', 'd'], 'A6_column':[1, 2, 4], 'B6_column':['a', 'b', 'd'], 'A7_column':[1, 2, 4], 'B7_column':['a', 'b', 'd']}) print(d) d 
+7
python pandas dataframe ipython jupyter-notebook
source share
1 answer

You can use the IPython display function to achieve this:

 from IPython.display import display display(d) 

screen shot

+11
source share

All Articles