GRA 41421 Data Management and Python Programming Assignment

Assignment Help Python Programming
Reference no: EM132389010

GRA 41421 Data Management and Python Programming

Question 1

Problem 1.


Write a program that asks the user to enter three numbers (use three separate input statements). Create variables called total and average that hold the sum and average of the three numbers and print out the values of total and average.

Problem 2.

Write a program that generates a list of 50 random integers such that the first integer number is between 1 and 2 (including 2), the second is between 1 and 3, the third is between 1 and 4, . . . , and the last is between 1 and 51.

Problem 3

Write a function that asks the user to enter a positive integer , and then computes (1+(1/2)+(1/3)+.....+(1/n))-ln(n). Plot the the value of your function for different values of n=10,100,500,1000,10000.

Problem 4.

Write a function that prints out whether a certain word contains any vowels and count the number of vowels. For example, you can test your function with the following words "Antidisestablishmentarianism" and "Menneskerettighetsorganisasjonene".

Problem 5

At a certain school, student's email addresses end with @student.college.edu, while professor's email addresses end with @prof.college.edu. Write a program that first asks the user how many email addresses she/he will be entering, and then asks the user to enter those addresses. After all the email addresses are entered, the program should print out a message indicating how many students and professor's have been entered.

Problem 6

Companies often try to personalize their offers to make them more attractive. One simple way to do this is just to insert the person’s name at various places in the offer. Of course, companies don’t manually type in every person’s name; everything is computer-generated. Write a program that asks the user for a name and then generates an offer like the one below.

Enter name: Steve Jobs

Dear Steve Jobs,

I am pleased to offer you our new Platinum Plus Rewards card at a special introductory APR of 47.99 percent. Steve, an offer like this does not come along every day, so I urge you to call now toll-free at 1-800-314-1592. We cannot offer such a low rate for long, Steve, so call right away.

Problem 7

Rewrite the following nested loop as a list comprehension
ans = []
for i in range(10):
for j in range(40):
if (i%3==0) and (j%2==0) and (i>j):
ans.append((i, j))
print(ans)

Problem 8

Suppose we want to create an output dictionary which contains only the odd numbers that are present in the input list (see below) as keys and their cubes as values. Show how to do this using for loops and dictionary comprehension.

To test your function, consider the following list :
np.random.seed(100)
list_integer = np.random.randint(0, 1000,size= 200)

Question 2

1. Create a function that inputs a word (string) and returns True (boolean) when there is no repeated letter in the word. For example, the word "troublemakings" should return a True value, and the word "sheet" should return a False.

2. Read the text file ShakespeareSonets.txt which contains an extract of THE SONNETS by William Shakespeare in text format. Remove the punctuation marks (such as ",", ".", ":", "'", "?", etc.), and also remove the numbers from the text (such as "1", "2", etc).

3. Select from the text those words which do not contain a repeated letter. Compute the length of each word and plot a histogram with the frequency of these words' length in the text.

Question 3

Read the data data_ECommerce_sample.csv . The data contains information about customers shopping using a web platform.

1. Show the type and number of observations for each variable.

2. Drop observations for which CustomerID is missing. Name the dataframe as ec

3. Change the column 'InvoiceData' into a datetime . Create a month variable and compute the total monthly quantity sold by the platform.

4. Compute the revenue per observation (call it Revenue ) as the product of Quantity and UnitPrice . Display the ten highest invoice orders in terms of revenue.

5. Compute the highest five invoice orders in terms of revenue for the UK, Germany, and France.

Question 4

We are going to use three datasets for this question. The description of the variables is as follows:

The dataset national_exam_5th_year_level_grade.csv contains the grade of the 5th-year National Exam in Norway.

Variable Description

Unnamed: 0               School code

2015_English_Boy     English grade for boys in year 2015

2015_English_girl    English grade for girls in year 2015

...                      ...

The dataset national_exam_5th_year_level_school_info.csv contains information on schools' location in Norway.

Variable                  Description

county code           County code
municipal code        Municipality code
county                  County name
municipal               Municipality name
public True if the school is public and False if the school is private
school School name
school code School code

The dataset income_nor.csv contains average household income for each municipality in Norway.

Variable Description

municipal code Municipality code

2017 Average household income of each municipality

1. Load the data national_exam_5th_year_level_grade.csv as a dataFrame df . Rename the first column as school_code and set it as the row index.

2. Create a hierarchical index for the columns. The index levels should be year, subject, and gender.

3. Show a table with average grades for the whole country by gender and subject in 2017.

4. Select Math and English grades for boys and girls for the year 2017, and call it dfs . Plot an histogram for each grade in a two-by-two figure (Please label the x- and y-axis and show the title for each subplot).

5. Load national_exam_5th_year_level_school_info.csv as a dataFrame dfk . You may notice that there are some strange strings in the column of county, municipal and school. Please replace those values ["¿","\x8c","¾","\x9f","¯","\x81","\x87","\x01"] with ["o", "aa","ae","u","o","aa","a","s"], respectively.

6. Merge DataFrames dfk with dfs on school_code . Call the merged dataset dfall .

7. Remove the schools with missing grade values and the municipalities with less than five schools.

8. Compute the mean of test grades for each municipality by subject and gender. Call teh dataframe mean_grade . Plot a bar chart for the ten municipalities with the highest Math scores for boys.

9. Load income_nor.csv as a dataFrame df_income . Keep the observations if the year is 2017. Set 'municipal code' as the index.

10. Merge the DataFrame income with mean_grade .

11. Plot the municipality's income against the average grade of boys and girls in Math using a scatter plot. Please show the legend and label the axis and title.

12. Run two regressions for boys and girls' Math grade on income. where grade is the average math for municipality , and is the average household income
gradei = α0 + α1 × incomei

where grade is the average math for municipality i, and is the average household income.

Reference no: EM132389010

Questions Cloud

About particular part of your professional experience : You will write a short essay that reflects your belief or passion about a particular part of your professional experience.
What would the df value be equal to : You decide to perform an experiment to determine how many offspring out of a litter of 10 dogs have blue eyes and to use a chi square table to confirm
What would be an example of a person : What would be an example of a person who has a BMI in the "Obese" range but who is actually quite trim?
Compare and contrast linear and logistic regression methods : Compare and contrast linear and logistic regression methods. Support your answer with use cases for each regression model
GRA 41421 Data Management and Python Programming Assignment : GRA 41421 Data Management and Python Programming Assignment help and Solutions, BI Norwegian Business School, Norway-Create variables called total and average.
Explain impact new cryptographic security architecture : Describe and explain the impact the new cryptographic security architecture will have on the current security features and how this impact will be mitigated.
HTH-620 Practical Theology Assignment Problem : HTH-620 Practical Theology Assignment Help and Solution, Grand Canyon University Homework Help - Define theology and describe the various disciplines
Discussion about sustaining quality of life in the city : In this course, you explore and contribute readings to the dialogue about sustaining quality of life in the city. Each week, you read the assigned articles.
ITSA2006 Server Virtualization Assignment Problem : ITSA2006 Server Virtualization Assignment Help and Solution, Victorian Institute of Technology, Australia - Configure vNetwork Standard Switches

Reviews

Write a Review

Python Programming Questions & Answers

  Write program that will calculate a tip and a tax on a meal

Write a program that will calculate a XXX% tip and a 6% tax on a meal price. Each programming assignment should have the following header, with italicized text appropriately replaced.

  Write a function that accepts two list of integers a1 and a2

Write a function named zero_out that accepts two lists of integers a1 and a2 as parameters and replaces any occurrences of a2 in a1 with zeroes.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Write a program that will generate a random recycle bin

Write a program that will generate a random recycle bin. This program will have a menu that allows the user to generate a new recycle bin.

  Solve the puzzle by using breadth-first tree or graph search

CISC 339 Aritificial Intelligence Group Project. Formulate the problem precisely. Solve the puzzle by using breadth-first tree or graph search

  Implement a program for a user to manipulate a readinglist

Define a function called print List that takes in a list as a parameter and prints the entries in the listone entry per line. Implement a program for a user.

  Write a function that takes as input the cost of the item

Write a function that takes as input the cost of the item that you are purchasing and a Boolean variable indicating.

  When we sort a list of items, we need a basis

When we sort a list of items, we need a basis on which to compare the items to see whether one is bigger than another. If it's a list of numbers, Python just compares the numeric values; if it's a list of strings, Python compares the strings alpha..

  Compute the sample standard deviation of a list of numbers

Function in Python to compute the sample standard deviation of a list of numbers. The return value should be the sample standard deviation.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  Find all of the different stores that are in the central

How would i find all of the different stores that are in the 'central' district?.

  Explain what python ides are being used in the industry

Explain what Python IDEs are being used in the industry? Compare/contrast features (chart might be helpful). Research differences between JES, IDLE and PyCharm.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd