yhat / ggpy

ggplot port for python
http://yhat.github.io/ggpy/
BSD 2-Clause "Simplified" License
3.7k stars 572 forks source link

How about make it available with dfply? #671

Open guokai8 opened 4 years ago

guokai8 commented 4 years ago

Hi, The ggplot is a nice package for python. However when I use dfply with the pipe function I can't make figure easily.

data = pd.DataFrame(
    {'col1':[1,1,1,1,1,2,2,2,2,2],
    'col2':[1,2,3,4,5,6,7,8,9,0],
     'col3':[-1,-2,-3,-4,-5,-6,-7,-8,-9,0]
    }
)
data >> group_by(X.col1) >> summarise(mean=X.col2.mean(),std=X.col3.std()) >> ggplot(aes(x='col1',y='mean'))+geom_bar()

it will report a error with

__init__() missing 1 required positional argument: 'data'

How about do something minor changes to make ggplot accept the pipe data ?

Kai