Reputation: 59
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')
Upvotes: 4
Views: 9400
Reputation: 617
For those facing a similar problem while trying this out in "Google Colab" ( or not getting any image displayed in Google Colab )
From : https://stackoverflow.com/a/47230966/4106458
and combining this with the asFigure
parameter mentioned in the help message of iplot
at : https://github.com/santosjorge/cufflinks/blob/master/Cufflinks%20Tutorial%20-%20Plotly.ipynb
We can use the following code to render interactive Plotly graphs on Google Colab
import cufflinks as cf
(dataset[column]
.iplot(kind="box", asFigure=True) # Returns a Plotly Figure object
.show(renderer="colab")
)
Upvotes: 0
Reputation: 2859
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
)
Upvotes: 7