I have a folder with many csv files. They all look similar, they all have the same names for columns and rows. They all have strings as values in their cells. I want to concatenate them along columns AND rows so that all the strings are concatenated into their respective cells.
Example:
file1.csv
0 | 1 | 2 | 3 | 4 |
---|---|---|---|---|
b1 | peter | house | ash | plane |
b2 | carl | horse | paul | knife |
b3 | mary | apple | linda | carrot |
b4 | hank | car | herb | beer |
file2.csv
0 | 1 | 2 | 3 | 4 |
---|---|---|---|---|
b1 | mark | green | hello | band |
b2 | no | phone | spoon | goodbye |
b3 | red | cherry | charly | hammer |
b4 | good | yes | ok | simon |
What I want is this result with no delimiter between the string values:
concatenated.csv
0 | 1 | 2 | 3 | 4 |
---|---|---|---|---|
b1 | peter mark | house green | ash hello | plane band |
b2 | carl no | horse phone | paul spoon | knife goodbye |
b3 | mary red | apple cherry | linda charly | carrot hammer |
b4 | hank good | car yes | herb ok | beer simon |
And I don't know how to do this in pandas in a jupyter notebook.
I have tried a couple of things but all of them either kept a seperate set of rows or of columns.