Skip to content

Question: How to call plot.hist, post.line etc methods on a pandas Series ? #210

@thecontinium

Description

@thecontinium

Hi

Thanks for writing this library.

I am trying to call a method on a pandas Series object to produce a plot for various kinds of graphs.
I have this working when using plot alone but I can't find a way of invoking the plot.hist, plot.line, etc methods.

This works fine for different :kind's:

(def pandas-series (pandas/Series [1 2 3]))
(py. pandas-series "plot" :kind :hist)

but I want to call the plot.hist method. This fails:

(def pandas-series (pandas/Series [1 2 3]))
 (py. pandas-series "plot.hist") ; ==> (err) AttributeError: 'Series' object has no attribute 'plot.hist'

If I do this I find that the plot.hist is a PlotAccessor.hist

(def plot (py/get-attr pandas/Series "plot")) 
(py/get-attr plot "hist") ; ==> <function PlotAccessor.hist at 0x16666c560>

But how do I call this method on the pandas-series ?

All advice welcome - Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions