Make sure you have the Pandas library installed.

computer science

Description

1. Make sure you have the Pandas library installed.

2. Create a small spreadsheet of sample data with the following:

a. At least four columns with at least one with numeric data

b. The top row has the column names

c. At least 10 rows of random data

3. Write a Python script using the Pandas library to:

a. Read the excel file and put it directly into a DataFrame. You can assume the spreadsheet is in the same directory as the Python script.

b. Display all the data in the DataFrame

c. Display all rows with only 2 columns (of your choice).

d. Display all the columns and rows of the data based on some criteria applied to a numeric column (for example, all rows with values greater than 10). Just make sure you will get some data returned, but fewer than the entire set.


PartB:

1. Write a function called getName(). The purpose of the function is to ask the user for the user’s name, and return the name as a return value. There are no parameters to this function.

2. Write a function called getBirthdate(). The purpose of the function is to ask the user for the user’s birth date. The return value is an appropriately formatted date. There are no parameter s to this function. The important part of this function is to make sure the data input is valid. (Hint: you could ask the user for the month, day and year separately so you can make sure the input is valid.)

3. Write a function called age() that takes a properly formatted date as a parameter, and calculates the number of years from that date to today’s date. Only the age in years is returned as an integer. (Hint: the properly formatted date would be the output from getBirthdate().)

4. Put all three of the functions in a module called myUtilities.

5. Write a program to demonstrate how you import the module, and test the functions in that module.


Related Questions in computer science category