I got the following error in my python code:
TypeError: writelines() requires an iterable argument
I know it's error submited before but I can't got my answer . here is my code :
def Normaliaze(dataset):
final_list=[]
twoCol = [ item[0:2] for item in dataset]
labels = [ item[2] for item in dataset]
twoColData = preprocessing.scale(float64(twoCol ))
for x,y in itertools.izip(twoColData,labels):
temp =[]
temp.append(x[0])
temp.append(x[1])
temp.append(y)
final_list.append(temp)
caving = open('/home/nima/Desktop/ramin-ML-Project/caving.txt','w')
for item in final_list:
if item[2] == 'caving':
caving.writelines(item[0])
caving.writelines('\t')
caving.writelines(item[1])
caving.writelines('\n')