Question: How to split the data and normalize it import pandas as pd import numpy as np from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from

How to split the data and normalize it import pandas as pdimport numpy as np from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_splitHow to split the data and normalize it

import pandas as pd import numpy as np from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LinearRegression, Ridge, Lasso from sklearn.metrics import mean_absolute_error, mean_squared_error import matplotlib.pyplot as plt data = pd.read_csv('insurance.csv') print("Basic Information:") print(data.info( ) ) categorical_features = [x for x in data.columns if data[x].dtype "object"] numerical_features [x for x in data.columns if data[x].dtype != "object"] print("Categorical features:",categorical_features) print("Numerical features:", numerical_features) print(data.isnull().any() ) 1.2 Split the preprocessed dataset into training set and testing set Use 80% of samples as the training set and 20% of samples as the testing set In [15]: # your code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!