October 25, 2024
Chicago 12, Melborne City, USA
python

NameError: data_encoded' is not defined


when i analysis the data and make

data_encoded[numerical_cols] = scaler.fit_transform(data_encoded[numerical_cols])

it give me

NameError Traceback (most recent call last)
Cell In[140], line 1
—-> 1 data_encoded[numerical_cols] = scaler.fit_transform(data_encoded[numerical_cols])

NameError: name ‘data_encoded’ is not defined

and I also make
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import StandardScaler

Display the first few rows to check scaling

`your # Scale the numerical features (select specific numerical columns if necessary)
numerical_cols = [‘LotFrontage’, ‘LotArea’, ‘OverallQual’, ‘OverallCond’, ‘SalePrice’]
data_encoded[numerical_cols] = scaler.fit_transform(data_encoded[numerical_cols])

Display the first few rows to check scaling

print(data_encoded[numerical_cols].head())text`



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video