Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello everyone
I am trying to merge all the rows of a particular col of a csv but dont know how to approach it...
Python
for root,dirs,files in os.walk(path):
for directory in dirs:
   for root,dirs,files in os.walk(path+"/"+directory+"/rdc_engineer"):
       for file in files:
           if file=="enginner.csv":
              df=pd.read_csv(path+directory+"/rdc_engineer"+"/"+file)
              for elements in prediction:
                 df["Engineer Behaviour"]=pd.Series(elements)
                 df.to_csv(path+directory+"/rdc_engineer"+"/"+file,index=False)

What I have tried:

it just writes the element in the first row of a new col which i want to merge cells of so i want that all the cells in the row "engineer behaviour" should get merged with the element written in it.
Posted
Updated 28-Dec-18 4:33am
v3
Comments
Richard MacCutchan 28-Dec-18 9:00am    
Your code is incomplete. What is pd, what is prediction?
Member 14102554 28-Dec-18 9:47am    
pd is for pandas and prediction is the list contains items to be written in csv
Richard MacCutchan 28-Dec-18 10:16am    
Neither that information, nor the code above, give any clue as to what your problem is.
Member 14102554 28-Dec-18 10:33am    
the problem is that i want to merege all the cells in the col "engineer behaviour" thats it...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900