Site icon Analytics4All

Python Project 2.2: DataFrames


For this second project in module 2, I want you to code this code block below and run it in Python

x = {'Name': ['Bill','Carol','Jared','Rozmeen','Jeff','Juan','Lori'],
     'Age': [25,33,42,32,24,48,33],
     'JobTitle': ['Tech','Analyst','Manager', 'Consultant', 'DBA','Engineer', 'Analyst' ],
     'YearsService': [2,8,12,3,1,23,6]

Now, turn the dictionary above into a DataFrame

Next sort DataFrame by YearsService in ascending order

Copy and paste this code below into Python

Loc = ['London', 'NYC', 'Los Angeles', 'New Orleans', 'Paris','Miami', 'NYC']

Create a new column in the DataFrame called Location, using the list provided above

Next filter the DataFrame to only show the Analysts in the list

Now finally filter the DataFrame down to the 3 columns below.

Exit mobile version