Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- names = ['USA', 'Canada', 'UK']
- years = [1992,1834,1999]
- names_with_years = pd.Series(data = years, index = names)
- print(names_with_years['USA'])
- print(names_with_years['Canada'])
- print(names_with_years['UK'])
- print(names_with_years[0])
- print(names_with_years[1])
- print(names_with_years[2])
- my_dict = {'cat':20, 'dog':10, 'lion':3}
- print(pd.Series(my_dict))
- print(names_with_years.keys())
- names1 = ['Bulgaria', 'Canada', 'UK']
- years1 = [2003,2005,2003]
- names1_with_years = pd.Series(data = years1, index = names1)
- print(names1_with_years.add(names1_with_years, fill_value = 0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement