0

I have several csv files that share one column in common: "unique_id". I want to merge all the csv files into one csv file using pandas. Each file does not have the same number of rows. I want to have the output csv file have unique columns. It's fine if the merged file contains missing values. I am really confused on how to do this. An example of what I want is below:

csv1:
unique_id      date_of_birth      registered  
15ab           11/2/1990          Yes  
19qz           10/3/1980          No  
20b3                              Yes  
11b9a          3/18/1943  
4r2p                              No  
12p3           8/17/2003  

csv2:  
unique_id      fav_color     parents_alive  
15ab           blue          yes  
19qz           green         yes                              
11b9a                        no                  
12p3           pink    
79b2b2         red

csv3:  
unique_id     married       years_of_education   
15ab          Yes           8  
19qz          No            12  
79b2b2        Yes           6
2224b                       5  
100qwe3       Yes  
333o4         Yes           16    

Output csv:  
unique_id    date_of_birth    registered    fav_color    parents_alive    married    years_of_education
15ab         11/2/1990        Yes           blue         yes              Yes        8
19qz         10/3/1980        No            green        yes              No         12
20b3                          Yes
11b9a        3/18/1943                                   no
4r2p                          No
12p3         8/17/2003                      pink
79b2b2                                      red                           Yes        6
2224b                                                                                5
100qwe3                                                                   Yes
333o4                                                                     Yes        16

3

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.