Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, I have this code here, but I get errors for trying to make it Float when I use Jupyter Notebook for the data science
Hello,
I have this code here, but I get errors for trying to make it Float when I use Jupyter Notebook for the data science course.
I need to use the astype() function of the DataFrame to convert these MPG columns to float (see coding below).
new_df['City MPG'] = new_df['City MPG'].astype("float")new_df['Hwy MPG'] = new_df['Hwy MPG'].astype(float)new_df['Cmb MPG'] = new_df['Cmb MPG'].astype(float)
It says this:
It says: A value is trying to be set on a copy of a slice from a DataFrame.Try using .loc[row_indexer,col_indexer] = value instead
But I don't know how to edit my code to their requirement, and I would like your help with this.
Here is the screenshot of the original error.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started