Convert to numeric for jupyter notebook charts, graphs

I’m working on the visualize data with python course. I’m working on the data visualization portfolio project.

I’ve downloaded a csv file for the data. Whenever I try to use seaborn to make visualization, such as barplots, scatterplots, I keep getting messages that jupyter notebook is unable to interpret the data because the information isn’t numeric. How do I get the information to be numeric?

What is the dataset for this project? Can you please paste your formatted code and where you get the error?

Did you check the data types? ?

1 Like

Thanks for the link.

The data set focuses on car prices and their mileage. I’m trying to find a link between car prices and their mileages.

The code is:
“sns.barplot(data=cars, y=‘Mileage’, x=‘Price’)”

The error message is:
“Neither the x nor y variable appears to be numeric.”

This is the message when I use
<class ‘pandas.core.frame.DataFrame’>
RangeIndex: 4999 entries, 0 to 4998
Data columns (total 2 columns):

Column Non-Null Count Dtype

0 Price 4999 non-null object
1 Mileage 1830 non-null object
dtypes: object(2)
memory usage: 78.2+ KB

Seems like you have to change the data type to something more specifically numeric (int64, float64, etc). It’s currently the catch-all dtype, “object”.

This is the information I get when I use

Data columns (total 14 columns):
 #   Column               Non-Null Count  Dtype 
---  ------               --------------  ----- 
 0   Unnamed: 0           46022 non-null  int64 
 1   Company Name         46022 non-null  object
 2   Model Name           46022 non-null  object
 3   Price                46022 non-null  int64 
 4   Model Year           46022 non-null  int64 
 5   Location             46022 non-null  object
 6   Mileage              46022 non-null  int64 
 7   Engine Type          46022 non-null  object
 8   Engine Capacity      46022 non-null  int64 
 9   Color                46022 non-null  object
 10  Assembly             46022 non-null  object
 11  Body Type            46022 non-null  object
 12  Transmission Type    46022 non-null  object
 13  Registration Status  46022 non-null  object
dtypes: int64(5), object(9)
memory usage: 4.9+ MB

When I use sns.barplot(data=cars, x='Price', y='Mileage')

I still get a message saying Neither the x nor y variable appears to be numeric.

I installed the latest updates for seaborn.

I’ve tried running the cells again but I keep getting a message saying “The kernel appears to have died. It will restart automatically.”

You used Conda to install, yes?

Perhaps this will help: