load "bmi.csv" into the Dataframe and create a scatter plot of the data using relplot() with height on x-axis and weight on y-axis and color the plot points based on Gender and vary the size of the points by BMI index.
My code is:
import pandas as pd
import seaborn as sns
df = pd.read_csv('bmi.csv')
BMI = pd.DataFrame(df)
g = sns.relplot(x = 'Height', y = 'Weight', data=df);b
I get:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
g = sns.relplot(x = 'Height', y = 'Weight', data=df);b
File "/Users/aleksikurunsaari/Library/Python/3.10/lib/python/site-packages/seaborn/relational.py", line 862, in relplot
p = plotter(
File "/Users/aleksikurunsaari/Library/Python/3.10/lib/python/site-packages/seaborn/relational.py", line 538, in __init__
super().__init__(data=data, variables=variables)
File "/Users/aleksikurunsaari/Library/Python/3.10/lib/python/site-packages/seaborn/_oldcore.py", line 640, in __init__
self.assign_variables(data, variables)
File "/Users/aleksikurunsaari/Library/Python/3.10/lib/python/site-packages/seaborn/_oldcore.py", line 701, in assign_variables
plot_data, variables = self._assign_variables_longform(
File "/Users/aleksikurunsaari/Library/Python/3.10/lib/python/site-packages/seaborn/_oldcore.py", line 938, in _assign_variables_longform
raise ValueError(err)
ValueError: Could not interpret value `Height` for parameter `x`
Besides the error, why are you constructing a dataframe from a dataframe and also you're not using it ? I'm talking about
BMIhere :And regarding the error, this one has occured because
Heightis not one of the columns ofdf. I suggest you to check the content/shape/columns of this dataframe before plotting with seaborn. It may be a problem with the separator of your.csv.Dataset: https://github.com/aniketsoni1/BMI-Data-Insight-using-SVM/blob/master/bmi.csv