Search code examples
pythondataframeplot

'DataFrame' object has no attribute 'iplot'


Can I solve the following error: 'DataFrame' object has no attribute 'iplot'? I have to create box plot of every Category of my dataset imported form a csv file with pd.read_csv:

dataset = pd.read_csv(myfile)
dataset[columns].iplot(kind='box')

Solution

  • The pandas dataframe object does not have the iplot method when it isn't linked to plotly. We need cufflinks to link pandas to plotly and add the iplot method:

    import cufflinks as cf
    cf.go_offline()
    cf.set_config_file(offline=False, world_readable=True)
    

    After this, try plotting directly from the dataframe:

    dataset["columns"].iplot(kind="box")
    

    Install cufflinks with : pip install cufflinks --upgrade)