From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ken Mankoff Subject: Re: getting an hline in a python generated table Date: Fri, 03 Apr 2015 14:44:45 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ye6aL-0005yF-A7 for emacs-orgmode@gnu.org; Fri, 03 Apr 2015 14:44:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ye6aG-0000oi-AU for emacs-orgmode@gnu.org; Fri, 03 Apr 2015 14:44:53 -0400 Received: from mail-qc0-x22d.google.com ([2607:f8b0:400d:c01::22d]:35739) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ye6aG-0000nz-5P for emacs-orgmode@gnu.org; Fri, 03 Apr 2015 14:44:48 -0400 Received: by qcbii10 with SMTP id ii10so71694952qcb.2 for ; Fri, 03 Apr 2015 11:44:47 -0700 (PDT) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: John Kitchin Cc: Orgmode Mailing List 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 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