[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:46:02 -0400 |
Sorry about that. I switched out of Org mode in my email client so C-c C-c sent
the email instead of executing the code block. I was mid-sentence...
#+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')
print tab[1:-1]
#+END_SRC
#+RESULTS:
> 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