Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ipython notebook align table to the left of cell

I have below ipython notebook code (markdown):

#### example table |Name|Description| |--|-------------------------------| |Mary |She is a nice girl.| |Jackie |He is a very naughty boy.| 

The output looks like below: enter image description here

How can I:

  1. Left align the table of the cell, it's center by default now.
  2. Right align the second col text.
like image 485
lucky1928 Avatar asked Feb 19 '14 21:02

lucky1928


People also ask

How do you left-align a table in Jupyter notebook markdown?

To left-align a column, put a colon to the left of two dashes :-- . Three dashes --- can also be used.

What does %% capture do?

Capturing Output With %%capture IPython has a cell magic, %%capture , which captures the stdout/stderr of a cell. With this magic you can discard these streams or store them in a variable. By default, %%capture discards these streams. This is a simple way to suppress unwanted output.


2 Answers

Well, yes !

| Name | Description | age          | :- |-------------: | :-: |Mary| She is a nice girl.  | 20 | Jackie Junior | He is a very naughty boy. | 5 
  • :--- or --- = left align
  • ---: = right align
  • :---: = centered

table

like image 51
jrjc Avatar answered Sep 19 '22 19:09

jrjc


Answer to the 1st question - left-align the table - create and run a code cell above the table markdown cell, with the following content:

%%html <style> table {float:left} </style> 
like image 39
knuth Avatar answered Sep 21 '22 19:09

knuth