I working on merging to different a CSV file as:
input a.csv:
myID name day age
111 james Feb 29
112 alexs Mar 19
113 kevin Jan 18
114 bratt Jul 22
115 nancy Apr 30
Input b.csv:
myID visitedCity
111 boston
111 san fran
111 paris
112 texas
113 fargo
114 austin
114 los alto
115 memphis
As it shows the file b.CSV
has the same myID column names that used in a.CSV
and contains similar id's, however, file b.CSV
contains duplicated ID's which shows how many cities visited.
Question is: how I can merge the data from the input a.CSV
to the b.CSV
like follows:
myID visitedCity name day age
111 boston james Feb 29
111 san fran james Feb 29
111 paris james Feb 29
112 texas alexs Mar 19
113 fargo kevin Jan 18
114 austin bratt Jul 22
114 los alto bratt Jul 22
115 memphis nancy Apr 30
I already checked some posts such as this but it's not what I want.