Task 5 - Dictionaries, Lists and data manipulation#

In this part we explore another fundamental data structure in python, called Dictionaries.

5.1: Create a dictionary#

Create a dictionary that has 3 keys: name, age and salary, and enter in the following dummy information.

Sample output#

{‘name’: ‘Tim Cook’, ‘age’: 59, ‘salary’: 3000000.0}

#Your Solution Here

5.2: Create another dictionary#

Create a second dictionary, this time with at least 5 different names, ages, and salaries.

Hint: There should only be three keys, and the values should be a list.

Sample Output#

{‘name’: [‘Tim Cook’, ‘Person 2’, ‘Person 3’,’Person 4’, ‘Person 5’], ‘age’: [59, 24, 40, 20, 54], ‘salary’: [30000000.0, 200000.0, 900000.0, 450000.0, 20000.0]}

#Your Solution Here

5.3: Create a dataframe from a dictionary#

Create a pandas dataframe using the dictionary you created above

Hint: Use the pd.DataFrame.from_dict() method

Sample output#

#Your Solution Here

5.4: Rename all three columns of the dataframe#

Hint: you should use the pandas function rename() to accomplish this. You can rename it to whatever you like, just show us you are able to use this function

# Your Solution Here