I have the following dframe
and attempted code below.
import pandas as pd
dframe = pd.DataFrame({
'A' : [1,2,3],
'B' : ['Guitar', 'Piccolo', 'Sax']
})
dframe
for item in dframe:
print(f"{"Mary's favorite number is"}{dframe[0]}{"and her favorite instrument is"}{dframe[1]}")
The expected output is a formatted string for each line of the code indicating "Mary's favorite letter is 1 and her favorite instrument is Guitar", "Mary's favorite letter is 2 and her favorite instrument is Piccolo", etc.
However, the code does not seem to produce these results.