Informatics Practices

Write a Python Program to create a Pandas Series as shown below using a dictionary. Note that the left column indicates the indices and the right column displays the data.

RussiaMoscow
HungaryBudapest
SwitzerlandBern

Python Pandas

1 Like

Answer

import pandas as pd 
data = {'Russia':'Moscow','Hungary':'Budapest','Switzerland':'Bern'} 
s = pd.Series(data) 
print(s)

Output

Russia           Moscow
Hungary        Budapest
Switzerland        Bern
dtype: object

Answered By

1 Like


Related Questions