June 25, 2022
Today's widget is an answer that traverses kernal density estimates (KDE), bandwidth sliders, and geysers.
Q: What is this geyser's eruption interval? Eruptions are triggered when the geyser's superheated water builds up enough pressure underground. Silica drops out of the cooling water as the water rises to the surface; forming an underground protective coating.
STEPS
from IPython.display import HTML
HTML("""
"<iframe width="560" height="315" src="https://www.youtube.com/embed/A3x65YP7rkQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>"
""")
#avoid ssh certificate error message
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
sb.get_dataset_names()
['anagrams', 'anscombe', 'attention', 'brain_networks', 'car_crashes', 'diamonds', 'dots', 'exercise', 'flights', 'fmri', 'gammas', 'geyser', 'iris', 'mpg', 'penguins', 'planets', 'taxis', 'tips', 'titanic']
# load "" dataset
data = sb.load_dataset("geyser")
data.tail()
duration | waiting | kind | |
---|---|---|---|
267 | 4.117 | 81 | long |
268 | 2.150 | 46 | short |
269 | 4.417 | 90 | long |
270 | 1.817 | 46 | short |
271 | 4.467 | 74 | long |
# plot "waiting" column as x-axis
# outline width (lw), fill to shade, color default is blue
# bandwidth adjust (bw_adjust):
# inc for more jagged peaks
# dec for smoother peaks
sb.kdeplot(data.waiting, lw=3, fill=True, color="orange", bw_adjust=1)
plt.xlim(0, 120)
plt.ylim(0, 0.038)
# default xlabel is {column name}; default ylabel is "Density"
plt.xlabel("Wait Time (minutes)")
plt.ylabel("Kernal Density Estimate")
plt.suptitle("Geyser Eruption Wait Time")
plt.title("Seaborn Geyser Dataset")
Text(0.5, 1.0, 'Seaborn Geyser Dataset')