Skip to content

lmplot issue #20

@jenfenghsu

Description

@jenfenghsu

System: Julia 1.2.0 on Jupyter, Julia 1.10 on my other laptop has the same issue.

using PyPlot, Plots
using CSV, DataFrames
using Seaborn; sns = Seaborn;

df = CSV.read("Pokemon.csv", header=1);
sns.lmplot(x=df.Attack, y=df.Defense, data=df, fit_reg=false)

runs into error:
PyError ($(Expr(:escape, :(ccall(#= C:\Users\jhsu.julia\packages\PyCall\zqDXB\src\pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'>
TypeError("'PyCall.jlwrap' object is not subscriptable",)
File "C:\Users\jhsu.julia\conda\3\lib\site-packages\seaborn\regression.py", line 551, in lmplot
data = data[cols]

Stacktrace:
[1] pyerr_check at C:\Users\jhsu.julia\packages\PyCall\zqDXB\src\exception.jl:60 [inlined]
[2] pyerr_check at C:\Users\jhsu.julia\packages\PyCall\zqDXB\src\exception.jl:64 [inlined]
[3] _handle_error(::String) at C:\Users\jhsu.julia\packages\PyCall\zqDXB\src\exception.jl:81
[4] macro expansion at C:\Users\jhsu.julia\packages\PyCall\zqDXB\src\exception.jl:95 [inlined]
[5] #110 at C:\Users\jhsu.julia\packages\PyCall\zqDXB\src\pyfncall.jl:43 [inlined]
[6] disable_sigint at .\c.jl:446 [inlined]
[7] __pycall! at C:\Users\jhsu.julia\packages\PyCall\zqDXB\src\pyfncall.jl:42 [inlined]
[8] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{}, ::Int64, ::PyCall.PyObject) at C:\Users\jhsu.julia\packages\PyCall\zqDXB\src\pyfncall.jl:29
[9] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{}, ::Base.Iterators.Pairs{Symbol,Any,NTuple{4,Symbol},NamedTuple{(:x, :y, :data, :fit_reg),Tuple{CSV.Column{Int64,Int64},CSV.Column{Int64,Int64},DataFrame,Bool}}}) at C:\Users\jhsu.julia\packages\PyCall\zqDXB\src\pyfncall.jl:11
[10] #call#117 at C:\Users\jhsu.julia\packages\PyCall\zqDXB\src\pyfncall.jl:86 [inlined]
[11] (::getfield(PyCall, Symbol("#kw#PyObject")))(::NamedTuple{(:x, :y, :data, :fit_reg),Tuple{CSV.Column{Int64,Int64},CSV.Column{Int64,Int64},DataFrame,Bool}}, ::PyCall.PyObject) at .\none:0
[12] #lmplot#4(::Base.Iterators.Pairs{Symbol,Any,NTuple{4,Symbol},NamedTuple{(:x, :y, :data, :fit_reg),Tuple{CSV.Column{Int64,Int64},CSV.Column{Int64,Int64},DataFrame,Bool}}}, ::typeof(lmplot)) at C:\Users\jhsu.julia\packages\Seaborn\E3HS0\src\Seaborn.jl:55
[13] (::getfield(Seaborn, Symbol("#kw##lmplot")))(::NamedTuple{(:x, :y, :data, :fit_reg),Tuple{CSV.Column{Int64,Int64},CSV.Column{Int64,Int64},DataFrame,Bool}}, ::typeof(lmplot)) at .\none:0
[14] top-level scope at In[31]:1

However, using replot:
sns.regplot(x=df.Attack, y=df.Defense, fit_reg=true)
yields expected plot.

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