From: Ken Mankoff <mankoff@gmail.com>
To: sebastian.miele@gmail.com
Cc: emacs-orgmode@gnu.org
Subject: Re: noweb and :var statements
Date: Sun, 06 Oct 2019 22:05:07 +0200 [thread overview]
Message-ID: <87imp1fxnl.fsf@gmail.com> (raw)
In-Reply-To: <87k19hirz7.fsf@gmail.com>
Hi Sebastian,
I'm not getting the results I expect from your MWE either. Perhaps I gave too much code and asked X when what I really want is Y. I think I've distilled it to this:
What is the most elegant Org way to get a table into a Python array?
I can code it directly:
#+BEGIN_SRC python
<<setup>>
print(foo)
#+END_SRC
And now I can hide <<setup>> in a section at the bottom of the document. If it looks like this, everything works:
#+NAME: setup
#+BEGIN_SRC python
foo = np.array([42,43,44])
#+END_SRC
But is there a more elegant method? Can I get the same behavior if the data I want is in an Org table rather than hard-coded directly in Python?
Ideally, I'd like to have:
#+NAME: setup
#+BEGIN_SRC python
<<setup(table="foo_data" varname="foo")>>
<<setup(table="bar_data" varname="bar")>>
#+END_SRC
And a #+NAME: setup block that takes a :var table and sticks it in the :var varname variable.
And then after calling <<setup>> be able to use variable "foo" and "bar" that are generated from column or 2D Org tables elsewhere in the document. Can I do this in Org?
Thanks,
-k.
next prev parent reply other threads:[~2019-10-06 20:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-06 16:33 noweb and :var statements Ken Mankoff
2019-10-06 19:39 ` Sebastian Miele
2019-10-06 19:52 ` Sebastian Miele
2019-10-06 20:08 ` Ken Mankoff
2019-10-06 21:08 ` Sebastian Miele
2019-10-06 21:17 ` Sebastian Miele
2019-10-07 5:18 ` Ken Mankoff
2019-10-07 9:22 ` Sebastian Miele
2019-10-06 20:05 ` Ken Mankoff [this message]
2019-10-06 20:55 ` Sebastian Miele
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=87imp1fxnl.fsf@gmail.com \
--to=mankoff@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=sebastian.miele@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).