emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Ken Mankoff <mankoff@gmail.com>
Cc: Orgmode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: getting an hline in a python generated table
Date: Fri, 03 Apr 2015 16:18:10 -0400	[thread overview]
Message-ID: <m2pp7lj799.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <m2d23l2gph.fsf@gmail.com>

cool, thanks for the tip. I was not awware of that library.
Ken Mankoff writes:

> 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 :session
>   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')
>   tab[1:-1]
> #+END_SRC
> #+RESULTS:
> |     |     col1 |     col2 |
> |-----+----------+----------|
> | foo | 0.223272 | 0.433449 |
> | bar | 0.855854 |  0.13685 |
>
> 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 :session. If you don't use IPython/elpy in Org, then your final statement may need to be different (add a 'return'?) to get this to work.
>
> Hope this helps with w/ tables + headers,
>
>   -k.

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

  reply	other threads:[~2015-04-03 20:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01 20:07 getting an hline in a python generated table John Kitchin
2015-04-01 20:50 ` Rasmus
2015-04-03 18:44 ` Ken Mankoff
2015-04-03 18:46   ` Ken Mankoff
2015-04-03 20:18     ` John Kitchin [this message]
2015-04-03 20:42 ` William Henney
2015-04-03 20:47   ` John Kitchin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2pp7lj799.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=mankoff@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).