I have two tables (table1, table2) of the following:
table1:
| ID | Filename |
|---|---|
| 12345 | 12345.txt |
| 12346 | 12346.txt |
| 12347 | 12347.txt |
| 12348 | 12348.txt |
| 12349 | 12349.txt |
| 12350 | 12350.txt |
table2: contains the path where table 1 files are present
| Path |
|---|
| /table/text3/12349.txt |
| /table/text1/12345.txt |
| /table/text2/12346.txt |
| /table/text1/12350.txt |
| /table/text3/12347.txt |
| /table/text1/12348.txt |
How do I combine these two files, such that, the path and filenames are matched. What I tried so far?
pd.concat([table1, table2])
I also tried pd.merge but it does not match with the filename. How do I solve this?
The desired output:
| ID | Filename | Path |
|---|---|---|
| 12345 | 12345.txt | /table/text1/12345.txt |
| 12346 | 12346.txt | /table/text2/12346.txt |
| 12347 | 12347.txt | /table/text3/12347.txt |
| 12348 | 12348.txt | /table/text1/12348.txt |
| 12349 | 12349.txt | /table/text3/12349.txt |
| 12350 | 12350.txt | /table/text1/12350.txt |