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.


Reply via email to