emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Org babel Python and R, table not transformed when :var is called ?


From: Ihor Radchenko
Subject: Re: Org babel Python and R, table not transformed when :var is called ?
Date: Sun, 16 Oct 2022 11:23:30 +0000

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>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]