Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error using simple kdeplot example from the doc

I want to execute the following example from the doc in a jupyter notebook : https://seaborn.pydata.org/generated/seaborn.kdeplot.html

tips = sns.load_dataset("tips")
sns.kdeplot(data=tips, x="total_bill", hue="time")

But I get an error :

ValueError: could not convert string to float: 'Sun'

I use seaborn 0.10.1 and python 3.8.3

It works when I use :

tips = sns.load_dataset("tips")
sns.kdeplot(data=tips.total_bill)

But in this case, I can't use hue with the time column.

like image 505
jtobelem Avatar asked Apr 30 '26 20:04

jtobelem


1 Answers

I fixed it by upgrading seaborn to 0.11 using :

pip install seaborn --upgrade

With conda, the version didn't upgrade after 0.10.1

like image 178
jtobelem Avatar answered May 05 '26 08:05

jtobelem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!