0

This is my Code for write data in csv file.I want to update row of particular index.when I use W+ It is update All Containt of File I want to update particular row wise .

if(index==list.index(total_Rsq)and total_Rsq>MinList)  :   


   s1=list.index(total_Rsq)
   with open("D:/Krutsi_RandD/Python/NNFiles/summary1.csv", 'w+') as csvfile: 
              rows = [[ s1,NN.inputLayerSize,'-',NN.hiddenLayerSize,'-',NN.outputLayerSize , Rsquare , Rsquare1 , argument1 , argument2,list[index]]]
              csvwriter = csv.writer(csvfile)  # creating a csv writer object 
              csvwriter.writerows(rows)   # writing the data rows 
              dummy_var1=total_Rsq

else:
   with open("D:/Krutsi_RandD/Python/NNFiles/summary1.csv", 'a') as csvfile: 

               rows = [[ s1,NN.inputLayerSize,'-',NN.hiddenLayerSize,'-',NN.outputLayerSize , Rsquare , Rsquare1 , argument1 , argument2,list[index]]]
               csvwriter = csv.writer(csvfile)  # creating a csv writer object 
               csvwriter.writerows(rows)   # writing the data rows 
               dummy_var1=total_Rsq
2
  • 1
    Please reformat the code properly! Commented Mar 12, 2019 at 6:52
  • Didn't get you properly but this might solve your issue Adam Smith's Answer Commented Mar 12, 2019 at 7:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.