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.

Python Project 2.1 – Create a Module

In this project, I want you to create your own module. The module needs to have 3 methods (functions):

  • Method called Intro > Accepts 1 argument > Name > Prints “My name is <the inputted name>”
  • Method called Job > 2 args > Name, Job > Prints “Hi, I am <name>, and I am a <job>”
  • Method called Pets >2 args > Number, Pets > Prints “I have <number> <pets>”

Open a new python script, import your module and test the three methods.