emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] getting an hline in a python generated table


From: Ken Mankoff
Subject: Re: [O] getting an hline in a python generated table
Date: Fri, 03 Apr 2015 14:44:45 -0400

I've been using the following to generate hline in Org Python blocks:

#+BEGIN_SRC python :results table :exports results
  from tabulate import tabulate
  import pandas as pd
  df = pd.DataFrame(np.random.rand(2,2), index=['foo','bar'])
  tab = tabulate(df, ['col1','col2'], tablefmt='orgtbl')
  return tab[1:-1]
#+END_SRC
#+RESULTS:
|     |       col1 |     col2 |
|-----+------------+----------|
| foo |   0.363568 | 0.647676 |
| bar | 0.00663499 | 0.100717 |

I'm compensating for some bugs here. The tab[1:-1] is from, I think, tabulate, 
or perhaps IPython. I don't get results without this being a 
Since I use Org + IPython, I find that my 

On 2015-04-01 at 16:07, John Kitchin <address@hidden> wrote:
> Hi everyone,
>
> In emacs-lisp, I can get a table as output that has a horizontal line
> in it like this:
>
> (append '((name scopus-id h-index n-docs n-citations))
>         '(hline)
>         (some expression that generates a list))
>
> The first row is header names, then a horizontal line, followed by a row
> for each thing of interest. This seems to work because the result is an
> emacs-lisp "array".
>
> I cannot figure out if this is possible in a Python block though. So far
> my experiments have failed because I don't know how to make an hline
> symbol in a Python array. Any kind of string just shows as a row. Any
> thoughts on if this is possible?
>
> thanks,


#+OPTIONS: tex:imagemagick
#+OPTIONS: toc:0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]