1

When I create a table in ipython notebook, how can I escape pipes inside of text.

This is what I have

identifier | class name | args | distance function
------------|------------------|-------------------
“euclidean” | EuclideanDistance | | sqrt(sum((x - y)^2))
“minkowski” | MinkowskiDistance |p| `sum(|x - y|^p)^(1/p)`

It comes out as like below but obviously sum(|x - y|^p)^(1/p) is a formula and all the texts need to stay together...

enter image description here

3
  • How about using ipy_table? See epmoyer.github.io/ipy_table Commented Aug 26, 2015 at 19:56
  • Oh this is a workaround! But ideally, I would like to do it without any additional library. So that when I distribute my notebook, others don't have a trouble. Commented Aug 26, 2015 at 20:10
  • 1
    You can put raw HTML in a markdown cell including an HTML table. Examples of HTML table format are at w3schools.com/html/html_tables.asp. Commented Aug 26, 2015 at 20:24

1 Answer 1

1

Use the escaped pipe version | to display the pipe characters properly when table is rendered for ipython notebook markdown cells.

identifier | class name | args | distance function
------------|------------------|-------------------
“euclidean†| EuclideanDistance | | sqrt(sum((x - y)^2))
“minkowski†| MinkowskiDistance |p| sum(|x - y|^p)^(1/p)

*make sure you get rid of the tick marks.

Outcome in notebook should display as such:

ipython markdown - table containing pipes

Sign up to request clarification or add additional context in comments.

1 Comment

Awesome! Thank you Mr cchi!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.