From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ken Mankoff Subject: Re: noweb and :var statements Date: Sun, 06 Oct 2019 22:05:07 +0200 Message-ID: <87imp1fxnl.fsf@gmail.com> References: <87k19hg7g1.fsf@gmail.com> <87k19hirz7.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:60794) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHCmF-0005iG-Nz for emacs-orgmode@gnu.org; Sun, 06 Oct 2019 16:05:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHCmE-0004DU-NW for emacs-orgmode@gnu.org; Sun, 06 Oct 2019 16:05:11 -0400 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]:42239) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iHCmE-0004Am-Fj for emacs-orgmode@gnu.org; Sun, 06 Oct 2019 16:05:10 -0400 Received: by mail-lj1-x233.google.com with SMTP id y23so11416147lje.9 for ; Sun, 06 Oct 2019 13:05:10 -0700 (PDT) In-reply-to: <87k19hirz7.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: sebastian.miele@gmail.com Cc: emacs-orgmode@gnu.org 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 <> print(foo) #+END_SRC And now I can hide <> 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 <> <> #+END_SRC And a #+NAME: setup block that takes a :var table and sticks it in the :var varname variable. And then after calling <> 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.