From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
To: hallo@rensoliemans.nl, rhstanton@berkeley.edu
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: Re: How to specify column alignment in LaTeX table output?
Date: Fri, 10 Jan 2025 07:13:18 +0100 [thread overview]
Message-ID: <CAO48Bk8BbB6rLN+O4Sz6ZpUs8JMAyvaL_=wJw1eYgPfiy6R3ng@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1286 bytes --]
Hi,
For org tables generated in Python, I use python-tabulate. Actually, I
forked the original library to include the possibility of generating the
latex attributes from Python too.
Something like:
--- cut here ---
#+BEGIN_SRC python :results value raw :exports results
import math
import pandas as pd
import tabulate
xvals = [math.pi * i / 5 for i in range(10)]
df = pd.DataFrame({
'x': xvals,
'sin(x)' : [math.sin(xvals[i]) for i in range (10)],
'cos(x)' : [math.cos(xvals[i]) for i in range (10)]
})
attrs=':environment longtable :align p{2cm}p{2cm}p{2cm} :placement [h]
:center t'
return tabulate.tabulate(
df,
headers=df.columns, tablefmt='orgtbl', floatfmt=".3f",
caption='Table exported from Python with extended tabulate',
label='labextend',
attr_latex=attrs,
showindex=False)
#+END_SRC
#+RESULTS:
--- cut here ---
Take a look at https://github.com/paaguti/python-tabulate if it sounds
interesting.
CAVEAT: the author of python-tabulate wasn't very excited about this ;-)
Best, /PA
--
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler
Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet
[-- Attachment #2: Type: text/html, Size: 1948 bytes --]
next reply other threads:[~2025-01-10 6:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 6:13 Pedro Andres Aranda Gutierrez [this message]
2025-01-10 17:04 ` How to specify column alignment in LaTeX table output? Richard H Stanton
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='CAO48Bk8BbB6rLN+O4Sz6ZpUs8JMAyvaL_=wJw1eYgPfiy6R3ng@mail.gmail.com' \
--to=paaguti@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=hallo@rensoliemans.nl \
--cc=rhstanton@berkeley.edu \
/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).