Skip to content
Advertisement

ValueError: Could not interpret input ‘0’ with Seaborn?

I’m using the Kepler exoplanet dataset.

After loading it, and running a simple transpose() on it, in order to get the rows as columns, I try a seaborn boxplot, as follows: enter image description here

JavaScript

This returns:

JavaScript

I also attempted this:

JavaScript

and got a KeyError: '0' instead. What am I doing wrong? As far as I can tell, I’m doing the exact same thing as the first example on the official Seaborn website, here.

Advertisement

Answer

A workable example:

JavaScript

This outputs: RangeIndex(start=0, stop=5087, step=1) which shows us that the indices are actually integers, rather than strings e.g. ‘0’, ‘1’, ‘2’

Changing the code to sns.boxplot(data=df_train.tail(3197), x=0) fixes the issue.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement