@sandipp wrote:
I tried to run the following code in python but got syntax error… Could anyone help to resolve this issue?
-- coding: utf-8 --
“”"
Spyder Editor
This is a temporary script file.
“”"
#Importing liabraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#Importing data sets
dataset = pd.read_csv(‘Data.csv’)
X=dataset.iloc[:,:-1].values
y=dataset.iloc[:,3].values
#Taking care of missing data
from sklearn.preprocesing import Imputer
imputer = Imputer.(missing_values = ‘np.nan’, strategy = ‘mean’, axis = 0)
imputer = imputer.fit([X:,1:3])
X[:,1] = imputer.transform(X[:,1])
Error Message is :
File “”, line 18
imputer = Imputer.(missing_values = ‘np.nan’, strategy = ‘mean’, axis = 0)
^
SyntaxError: invalid syntax
Posts: 3
Participants: 3