Question
Python merges multiple files by id. I have a file with a file name and a header. I want to read that file so only
Python merges multiple files by id.
I have a file with a file name and a header. I want to read that file so only those files have s specific header which I need
So I have two folders that have multiple files inside and folders. Folder One has other multiple folders inside which and folder two has CSV files.
So i folder two I have multiple CSV file and they all will have id and header name {location}. all of them
In folder two I have another folder and they have inside some CSV files for example two.csv. and then it will have a header but the header can have different name like "location", "loc" or others.
So in the end, I want to have something like on the screenshot below when I am going to merge data by id and location from both of the folders.
\begin{tabular}{|l|l|} \hline file & header \\ \hline dataone & { location } \\ \hline datatwo & { location } \\ \hline datathree & { loc } \\ \hline \end{tabular} One Two datafour.csv dataone.csv datatwo.csv \begin{tabular}{|l|l|l|r|r|r|} \hline \multicolumn{2}{|c|}{ A } & B & \multicolumn{1}{c|}{ C } & D & E \\ \hline 1 & id & name & numbers & location & yeso \\ \hline 2 & 1 & Jon & 18 & 2 yes \\ \hline 3 & 2 & Ponk & 21 & 3 yes \\ \hline 4 & 3 & Dmytro & 19 & 4 yes \\ \hline 5 & 4 Jonatan & 20 & 5 yes \\ \hline 6 & 5 & Adry & 17 & 6 yes \\ \hline \end{tabular} Name > datafour > dataone > datatwo \begin{tabular}{|r|r|r|r|} \hline id & folder one & folder two & filename \\ \hline 1 & 2 & 2 dataone \\ \hline 2 & 3 & 3 dataone \\ \hline 3 & 4 & 4 dataone \\ \hline 4 & 5 & 5 dataone \\ \hline 5 & 6 & 6 dataone \\ \hline 6 & 2 & 2 datatwo \\ \hline 7 & 3 & 3 datatwo \\ \hline 8 & 4 & 4 datatwo \\ \hline 9 & 5 & 5 datatwo \\ \hline 10 & 6 & 6 datatwo \\ \hline 11 & 2 & 2 datathree \\ \hline 12 & 3 & 3 datathree \\ \hline 13 & 4 & 4 datathree \\ \hline 14 & 5 & 5 datathree \\ \hline 15 & 6 & 6 datathree \\ \hline \end{tabular}Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started