[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] noweb and :var statements
From: |
Ken Mankoff |
Subject: |
Re: [O] noweb and :var statements |
Date: |
Sun, 06 Oct 2019 22:05:07 +0200 |
User-agent: |
mu4e 0.9.18; emacs 26.3 |
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.
- [O] noweb and :var statements, Ken Mankoff, 2019/10/06
- Re: [O] noweb and :var statements, Sebastian Miele, 2019/10/06
- Re: [O] noweb and :var statements, Sebastian Miele, 2019/10/06
- Re: [O] noweb and :var statements, Ken Mankoff, 2019/10/06
- Re: [O] noweb and :var statements, Sebastian Miele, 2019/10/06
- Re: [O] noweb and :var statements, Sebastian Miele, 2019/10/06
- Re: [O] noweb and :var statements, Ken Mankoff, 2019/10/07
- Re: [O] noweb and :var statements, Sebastian Miele, 2019/10/07
Re: [O] noweb and :var statements,
Ken Mankoff <=