emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Jack Kamm <jackkamm@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Expanded ob-python results handling and plotting
Date: Sat, 29 Aug 2020 16:14:45 -0400	[thread overview]
Message-ID: <871rjptdje.fsf@kyleam.com> (raw)
In-Reply-To: <87eenpfe77.fsf@gmail.com>

Jack Kamm writes:

> The attached patch adds ob-python value results handling for the
> following types of results:
>
> - Dictionaries
> - Numpy arrays
> - Pandas dataframes
> - Matplotlib figures

Thanks.  Just a couple of drive-by comments...

> +                try:
> +                    import pandas as pd
> +                except ModuleNotFoundError:

ModuleNotFoundError wasn't added until Python 3.6, so I think it'd be
better to use its parent class, ImportError.

> +                    pass
> +                else:
> +                    if isinstance(result, pd.DataFrame):
> +                        result = [[''] + list(result.columns), None] + \
> +[[i] + list(row) for i, row in result.iterrows()]

Should handling of Series also be added?


  reply	other threads:[~2020-08-29 20:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-29 19:24 Jack Kamm
2020-08-29 20:14 ` Kyle Meyer [this message]
2020-08-30 14:59   ` Jack Kamm
2020-08-30 16:12     ` Jack Kamm
2020-09-20  4:51       ` Jack Kamm
2020-09-23  7:10         ` Bastien
2020-09-27 15:47           ` Jack Kamm

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=871rjptdje.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jackkamm@gmail.com \
    --subject='Re: [PATCH] Expanded ob-python results handling and plotting' \
    /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

Code repositories for project(s) associated with this 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).