emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: sebastien.rey-coyrehourcq@univ-rouen.fr
Cc: emacs-orgmode@gnu.org
Subject: Re: Org babel Python and R, table not transformed when :var is called ?
Date: Sun, 16 Oct 2022 11:23:30 +0000	[thread overview]
Message-ID: <87czasnhal.fsf@localhost> (raw)
In-Reply-To: <91cb65e0-4b2c-92ae-a69f-4d9ad8b3e1e3@univ-rouen.fr>

Sébastien Rey-Coyrehourcq <sebastien.rey-coyrehourcq@univ-rouen.fr>
writes:

> Perhaps it's a bug, or something i don't understand, i post on reddit 
> (https://www.reddit.com/r/emacs/comments/r5yt4a/r_talking_with_python_using_orgtable_not_work/) 
> to see if people on org community know the problem.
>
> I cross post here to see if it's a know bug or somethings ?
>
> There is something i don't understand,
> a difference between behavior of org-babel and org-mode when you use org 
> table to pass data using or not using :var.
>
> |#+NAME:mypythoncode #+begin_src python :results value raw :output 
> :return tabulate(df, headers=df.columns, tablefmt='orgtbl')

AFAIU, your tabulate call returns string, not a python table. So, :var
assignment indeed assigns a string. The returned string also happens to
use Org table format, which is why results block is an Org table.

By putting #+NAME to results block, you will be referring to its Org
syntax, which is then converted from Org table to R table, in contrast
to from Python result string to R string.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


      parent reply	other threads:[~2022-10-16 11:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01  8:04 Org babel Python and R, table not transformed when :var is called ? Sébastien Rey-Coyrehourcq
2021-12-02 11:10 ` Sébastien Rey-Coyrehourcq
2022-10-16 11:23 ` Ihor Radchenko [this message]

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=87czasnhal.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=sebastien.rey-coyrehourcq@univ-rouen.fr \
    /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).