Reputation: 31
I have a dataframe which has a list of names and email add, for example:
using yagmail
i want to send
a text to the email
add in DataFrame
.
Desired output should be like this mark->
sending email 1/3
jess->
sending email 2/3
riza ->
sending email 3/3
i used this approach:
for i in range(0, len(df1.index)):
print(f'sending email {str(df1.index[i])}/{len(df)}')
the output i am getting is:
mark->
sending email 1/3 sending email 2/3 sending email 3/3
jess->
sending email 1/3 sending email 2/3 sending email 3/3
riza ->
sending email 1/3 sending email 2/3 sending email 3/3
what did i do wrong?
Upvotes: -2
Views: 95
Reputation: 305
import pandas as pd
raw = { "Name": ["Mark", "Jess"],
"Gmail": ["[email protected]", "[email protected]"]}
df = pd.DataFrame(raw, columns=['Name', 'Gmail'])
res = [x + '-> ' + 'Sending Email' for x in df['Name']]
ind = [str(y)+'/'+str(len(df)) for y in df.index]
for i in range(0,len(res)):
print(res[i] + ' ' + ind[i])
Above code will solve your problem
Upvotes: 0