I need to split up a pandas dataframe by row into headed paragraphs. The column name is the heading and the cell value is the paragraph.
Example df (the actual df is much longer)
data = {'Title': ['Wormwood', 'Transmetropolitan', 'Y - The last man'],
'Author': ['Ben Templesmith', 'Warren Ellis', 'Brian K. Vaughan'],
'Abstract' :['Blah blah', 'Yadda yadda', 'Alas, poor Yorick! I knew him....']}
df = pd.DataFrame(data, columns = ['Title', 'Author', 'Abstract'])
my desired output is
Title: Wormwood
Author: Ben Templesmith
Abstract: Blah blah
Title: Transmetropolitan
Author: Warren Ellis
Abstract: Yadda yadda
Title: Y-the last man
Author: Brian K. Vaughan
Abstract: Alas, poor Yorick! I knew him....
Code I've tried
for i,j in zip(range(len(df.columns), range(len(df)):
print(f'***{df.columns[i]}***\n {df.iloc[j][j]}')
i+=1
j+=1
This kind of works but it seems really clunky and won't work on a longer more complex df.
For context, I'm basically trying to turn this df into a small booklet if that makes sense.