Python Programming Assignment

import numpy as np

import pandas as pd

my_list = [“A”, “B”, “C”,”D” ,”E”]

for i in my_list:

d = {‘value’: [1,2,3,4,5],’country’: [‘ES’,’IT’,’US’,’FR’,’NL’]}

df = pd.DataFrame(data=d)

print(df)

The output is:

country value
0 ES 1
1 IT 2
2 US 3
3 FR 4
4 NL 5
country value
0 ES 1
1 IT 2
2 US 3
3 FR 4
4 NL 5
country value
0 ES 1
1 IT 2
2 US 3
3 FR 4
4 NL 5
country value
0 ES 1
1 IT 2
2 US 3
3 FR 4
4 NL 5
country value
0 ES 1
1 IT 2
2 US 3
3 FR 4
4 NL 5

I want to write this output in excel csv file using the command : df.to_csv(“filename.csv” , index = False).

Where should I put this command in order to get an excel document as the output of my code?

In particular, I would prefer to get the column names “country” and “value” only once on the top of my excel document. Therefore the csv file should be like this:

country value
0 ES 1
1 IT 2
2 US 3
3 FR 4
4 NL 5

0 ES 1
1 IT 2
2 US 3
3 FR 4
4 NL 5

0 ES 1
1 IT 2
2 US 3
3 FR 4
4 NL 5

0 ES 1
1 IT 2
2 US 3
3 FR 4
4 NL 5

0 ES 1
1 IT 2
2 US 3
3 FR 4
4 NL 5

My Homework Nest
Calculate your paper price
Pages (550 words)
Approximate price: -
AllEscort