Format Like this email excel file
name email
A A@gmail.com
B B@gmailcom
C c@gmail.com
A A@gmail.com
B B@gmail.com
In second excel file outfile.csv This is the output
name email count
A A@gmail.com 2
B B@gmailcom 2
C c@gmail.com 1
This is python code First, I read the excel file
data_file=pd.read_excel('email.xlsx')
writer = csv.writer(open('outfiles.csv','wb'))
code = defaultdict(int)
for row in data_file:
code[row[0]] += 1
# now write the file
for row in code.items():
writer.writerow(row)
Error:
writer.writerow(row) TypeError: a bytes-like object is required, not 'str'
I am getting this error so could you please help me out.