I have a dataframe in Pandas, let's call it df. It has the following columns:
- ID - Which is a column ID number
- Files - Which contains a list of filenames
For example:
ID Files
1 [12, 15, 19]
2 [15, 18, 103]
And so on. Each element of the list corresponds to a text file with the same name, so "12" corresponds to "12.txt".
What I wanted to do was to create a third column called "Content" that took the text that was in each file in the list, concatenated it all together and put in the column. I was experimenting with for loops, but was wondering if there was a more efficient way to do it.
Thanks.