Your job is to write a program that accepts a research area (managed by an organization called a “Directorate” inside NSF), such as ‘BIO’ or ‘ENG’, and then computes the total grants per year since 1990 in that area. As you’ll discover below, the Python Standard Library provides several functions that will greatly ease your assignment. This assignment will test your ability to do computation (CLO1), read files (CLO2), use lists (CLO4), and use dictionaries (CLO5). It’ll also give an indication of whether you’re ready to learn about using 3rd-party libraries (CLO6).
Download a copy of Awards.csv and put it in the same folder where you’ll put your program. It will be handy for you to test your code. But keep in mind that the auto-grader will actually give a different file when testing and grading your code.
Use your text editor to create a .py file containing a Python program that contains a single function called totals_by_year(directorate) that accepts one parameter named directorate that will specify a research area such as ‘ENG’ (Engineering), ‘BIO’ (Biological Sciences) or ‘GEO’ (Geosciences).
Inside your function, do the following:
Open up the Awards.CSV file
Use the CSV file’s header row to determine the position of three columns: StartDate, AwardedAmountToDate, and NSFDirectorate
For each row,Read the StartDate, AwardedAmountToDate, and NSFDirectorate columns
Compute the year of the StartDate
If the year is earlier than 1990, then ignore the row and move on to the next. (Include 1990 and later. Exclude 1989 and earlier.)
If the NSFDirectorate is not directorate, then ignore the row and move on to the next
Keep a running total, by year, of all the grants’ AwardedAmountToDate given during that year for this directorate
Return a dictionary whose keys are the years and whose entries are the total grants for each year for this directorate
Simplified ExampleTo take a simplified example, suppose that the Awards.csv file only contained the following columns and rows. (The real CSV may have thousands of rows and very many columns, but this simple example will help to illustrate what your function totals_by_year() is supposed to compute.)
StartDateAwardedAmountToDateNSFDirectorate
2/2/2019$295,848.00ENG
4/5/2018$133,638.00BIO
2/17/2017$499,791.00ENG
3/4/2018$48,586.00BIO
1/19/2017$179,963.00BIO
8/8/1987$209,997.00ENG
Calling totals_by_year(‘BIO’) with the CSV above would match 3 rows. The total for 2018 would be $133,638.00+$48,586.00=182224. The total for 2017 would be just $179,963.00. So calling totals_by_year(‘BIO’) with the CSV above would return {2017:179963, 2018:182224}.
Calling totals_by_year(‘ENG’) with the CSV above would match 2 rows. Notice that the last row is before 1990 and would be ignored. The function would return {2017:499791, 2019:295848}.
(In practice, some rows might contain “O/D” which is a special meta-directorate, called the Office of the Directorate. You can treat it like any other directorate. It’s not special from the standpoint of the current assignment.)
Final Hints
The following additional guidance should ease your assignment…
The start date of each grant is stored in the CSV as a string in the format m/d/Y, where m is the month, d is the day, and Y is the year. The datetime module of the Python Standard Library has a function that you can use to convert each string into a datetime. Then, you can obtain the year of the datetime for use in your calculations.. You should have gotten some practice with this module (though not the specific function that you need) during a previous Exploration. You also can read about this function in Chapter 15 of your textbook.
The amount of each grant is stored in the CSV as a string that has a leading dollar sign, one or more comma, and trailing whitespace. You’ll need to remove these undesirable characters before you can call float() to convert the value into a floating-point number. A previous Exploration already discussed how to strip whitespace and remove undesired characters (by replacing them with an empty string) using string-manipulation functions provided by the Python Standard Library.
Do not assume that the StartDate, AwardedAmountToDate, or NSFDirectorate columns will be the only columns. The real CSV passed to your program may actually be much larger than the simplified example above. You cannot assume that the StartDate will be in the first column or in any specific column position, for example. Nor AwardedAmountToDate. Nor NSFDirectorate. You must use the header row of the CSV to determine the right column position. A previous Exploration demonstrated how using certain functionality of the csv module in the Python Standard Library enables you to look up the position of a desired column.
Category: Python
Design a program such that it converts a sentence into wordlist. Reverse the wordlist then.Write the code and output for the same.
By the end of this assignment, you will be able to perform addition, deletion, and sorting on the elements of the list as well shall be able to experiment list and related operators
(a). Consider that you are working as Data Analyst in an organization. The HR department needs you to carry out following operation on existing list of 10 employees name (you can assume 10 names in a list here).
Split the list into two sub-list namely subList1 and subList2, each containing 5 names.
A new employee (assume the name “Kriti Brown”) joins, and you must add that name in subList2.
Remove the second employee’s name from subList1.
Merge both the lists.
Assume there is another list salaryList that stores salary of these employees. Give a rise of 4% to every employee and update the salaryList.
Sort the SalaryList and show top 3 salaries.
Write the Python code and output for the same.
(b). Design a program such that it converts a sentence into wordlist. Reverse the wordlist then. Write the code and output for the same.
Note: The code and its output must be explained technically. The explanation can be provided before or after the code, or in the form of comments within the code.
Example: Suppose that your program receives the following CSV with data for 4 pa
Example: Suppose that your program receives the following CSV with data for 4 pa
Example: Suppose that your program receives the following CSV with data for 4 patients…
PatientSample
11223344GGTCGGTAGACAGGTCGGTAGACAGGTCGGTAGACA
22233344TTTCAGAATTAGACTGTTTAGAGAAACTAGACCACA
33344455CCTAGTATGCACTATTGAAATGCTCGTTGATAGACA
55667788TGCTCGTTAGTGAACACTTAGACTGTTTAGGACCAC
You know from a prior Exploration that these DNA sequences convert to…
Glycine,Arginine,.,Threonine,Glycine,Arginine,.,Threonine,Glycine,Arginine,.,Threonine
Phenylalanine,Glutamine,Asparagine,.,Threonine,Valine,.,Arginine,Asparagine,.,Threonine,Threonine
Proline,Serine,Methionine,Histidine,Tyrosine,.,Asparagine,Alanine,Arginine,.,.,Threonine
Cysteine,Serine,Leucine,Valine,Asparagine,Threonine,.,Threonine,Valine,.,Aspartic acid,Histidine
These are amino acid sequences, and your program’s job is to let the user search for patients whose amino acid sequences contain a user-specified sequence.
The program would prompt the user to enter an amino acid sequence, and the user might enter “Methionine,Histidine,Tyrosine,.” Your program would then iterate through the CSV, convert each DNA sequence to an amino acid sequence, and check to see if each patient’s amino acid sequence contained the user’s specified string. In this case, the third patient’s sequence contains the user input. Therefore, in this case, your program would print “33344455” on a line by itself (because that’s the patient’s ID, according to the CSV). If other patients also matched, then your program also would print their numbers, as well, one per line.
As another example, suppose that the user entered “Threonine,Valine,.” In this case, the second and fourth patients, above, would match. In that case, the program would print two lines of output containing “22233344” and “55667788”, respectively.
You can succeed in this assignment by doing four things.
1. Use your text editor to create a .py file containing a Python program that prompts the user to enter an amino acid sequence. Then, the program should call input() a single time to read the specified sequence into a variable called query. For example, the user might enter “Methionine,Histidine,Tyrosine,.” as in the example above.
2. Extend your program by adding code that reads in a CSV named “samples.csv” containing two columns: Patient and Sample. After the header row, every row’s Patient column will contain an 8-digit number, and the corresponding Sample column will contain a DNA sequence consisting of letters in the set T, G, A and C. The program should iterate through the rows of the CSV. You can use this CSV to test that your program can successfully iterate through the rows.
3. Near the top of your program, write a function called translate(dna) that takes one parameter called dna containing a DNA sequence and returns a string of the corresponding amino acid sequence. Your function should break the DNA sequence into chunks of 3 characters, convert the 3-character chunk into an amino acid, and then concatenate the amino acid sequence together into a string with one comma between each amino acid. Refer to your prior Exploration on DNA to remind yourself of the conversion from DNA chunks (called codons) to amino acids. Verify that this function works by passing some of the example DNA strings, above, into your translate() function to verify that the function returns the right output for each.
4. Go back to the part of your program where it iterates through the rows of the CSV and, inside the loop, pass the specified DNA sequence of each patient to your translate(dna) function. For each patient, you now have the patient’s number, the patient’s DNA (as a string), and the patient’s corresponding amino acid sequence (as a string). Write a conditional to see if the patient’s amino acid sequence contains the string stored in query. (Hint: use the in and not in Operators. Or use the find() function.) If the patient’s amino acid sequence contains the query, then print out that patient’s number on a line.
This assignment is worth 70 points:
10 points for reading the amino acid sequence into a variable called query
10 points for creating a function called translate(dna) near the top of your program
10 points if the translate(dna) function gives the correct outputs for the following inputs:GGTCGGTAGACAGGTCGGTAGACAGGTCGGTAGACA
TTTCAGAATTAGACTGTTTAGAGAAACTAGACCACA
CCTAGTATGCACTATTGAAATGCTCGTTGATAGACA
TGCTCGTTAGTGAACACTTAGACTGTTTAGGACCAC
10 points if the translate(dna) function gives the correct output for one other DNA string that you don’t know in advance (it’s a secret)
10 points if your program handles the following queries correctly for this CSV:It prints one line containing “33344455” when given a query of “Methionine,Histidine,Tyrosine,.”
It prints two lines containing “22233344” and “55667788” when given the input “Threonine,Valine,.”
20 points if your program handles another different CSV with many rows, and a query that you don’t know in advance (it’s a secret)
Pick a stock. Get the historical data from Yahoo Finance and calculate the latest 20-day moving average of prices.
Exercise 11.1
Pick a stock. Get the historical data from Yahoo Finance and calculate the latest 20-day moving average of prices. Make connection to IB IPA system and buy the stock if its price is above moving average and short-sell it if the price is lower than the moving average. You don’t need to design any mechanism to implement short-selling. Just simply sell the stock!
Exercise 11.2
Repeat the steps in question 1, but get the historical data from IB APA system this time.
Exercise 11.3
Are there any differences between your findings in questions 1 and 2? If yes, explain!
Please choose MICROSOFT stock
In this unit, we explored the basic concepts of fundamental concepts of Iterations and Strings in Python.
In this unit, we explored the basic concepts of fundamental concepts of Iterations and Strings in Python. Before completing this assignment, review the reading material listed below:
Think Python: How to think like a computer scientist Chapters 7 – Iterations (p. 63- 69)
Think Python: How to think like a computer scientist Chapters 8- Strings (p. 71- 79)
Please ensure that you review all examples presented in Chapters before you work on this assignment.
Write program to display your name and perform following operations on it: Display n characters from left. (Accept n as input from the user)
Count the number of vowels.
Reverse it.
The code and its output must be explained technically. The explanation can be provided before or after the code, or in the form of comments within the code. The descriptive part of your response must be at least 200 words.
If you use an informational source, be sure to identify the source and share the link to the source you used. This is a good time to start practicing some of what you learned about APA in UNIV 1001.
Total 20 Points.(You can submit/upload the complete ipynb file in the canvas) Ta
Total 20 Points.(You can submit/upload the complete ipynb file in the canvas)
Ta
Total 20 Points.(You can submit/upload the complete ipynb file in the canvas)
Task A. Data Visualization: 4 pointsGet the data “30_Industry_Portfolios.csv” data and “F-F_Research_Data_Factors.CSV” from class google drive.
For both data select date from January 01, 2000 to December 31, 2018
Draw a 2*2 scatterplot that reflect the relationship between (1) mkt-rf and food, (2) SMB and food, (3) mkt-rf and games and (4) SMB and games.
From the scatterplot what kind of relationshiop you see. [explain in words]
Task B. Regression Specification- Use the OLS function to estimate the follwoing: 10 PointsRun two univariate regression on Food and Games using excess market return (mkt-rf) as the dependent variable. Include a constant in the regressions.
Report the coefficient and t-stat of the market in this both industry, are they significant?
Report the R-squares of the models.
Run a multivarite regression for this two industry return (Food and Games) using all three Fama French Factors ( Market, SMB and HML).
Report the coefficient and t-stat of all three factors in both models, are they significant?
Report the R-squares of the models.
Is their any difference in the R-squares on 3 and 6. What doese this mean?
Task C. White’s covariance estimator: 6 pointsRe-estimate the two multivarite regression (Task B.4) with White’s covariance estimator.
Report the coefficient and t-stat of all three factors in both models, are they significant?
Are the parameter standard errors similar using the two covariance estimators (homoskedastic errors in Task B.4 and White’s covariance estimator). If not, what does this mean?
Report Format: Title Page: Include case-study title, student ID, and full name
Report Format:
Title Page: Include case-study title, student ID, and full name
Report Format:
Title Page: Include case-study title, student ID, and full name.
Classes and Relationships Definitions (5 marks): Identify and list the classes with their related attributes and behaviours.
Class Diagram (20 marks): Draw the UML class diagram, with class relationships and cardinality for the case study selected. Please explain the relationships, assumptions (if any), and the rationale for the choices.
Conclusion (5 marks): In this section include a reflection on what was learned in this exercise, the challenges faced while working on this assignment, and how the system can be further expanded.
Case Study: Volunteering Management System
Description:
You are required to design and develop a Volunteering Management System using Object-Oriented Programming concepts. The system should facilitate the efficient coordination, organization, assignment of tasks, and tracking of volunteer hours. This system serves as a centralized platform to streamline the entire volunteering process, from volunteer registration to task assignment and reporting. The volunteering Management System empowers organizations to effectively recruit, manage, and retain volunteers while fostering a culture of collaboration, community engagement, and social impact. Part of the system requirements is described below. You also are required to do a self-study about volunteering management and the different aspects related to the volunteering process.
Requirements:
The Volunteering Management System offers services for three types of actors: Administrator, Organization Representative, and Volunteer. The system should allow administrators to register organizations and assign one or more representatives to each organization. The administrator can print different reports including volunteering certificates for volunteers, and volunteering statistics. Organization representatives can create, update, and delete volunteer opportunities. Each opportunity includes essential details such as date, time, location, and list of tasks. Every task includes title, required skills, number of volunteering hours per volunteer, and the number of volunteers needed. Organization representatives can assign volunteers to specific tasks, and they can update the status of assigned tasks (e.g. completed/not completed) after the volunteering event. Volunteers can register in the system with their details (full name, ID, mobile, email, education level, skills), view available volunteering opportunities, and register their interest to join a volunteering opportunity. Volunteers also can view their assigned tasks, accomplished tasks, and total volunteering hours.
Project Deliverables If your program is working, submit the source code of your
Project Deliverables
If your program is working, submit the source code of your
Project Deliverables
If your program is working, submit the source code of your program. You must demonstrate your program is working during the demonstration. Submit the source code, input file(s), output file(s), and visualizations/results.
Please be sure to include thorough comments throughout your program where necessary. The comments should explain the code step-by-step during the demonstration.
Provide a detailed description of your algorithm and program flow. Be sure to include a step-by-step description of the tools that you used (compiler, libraries, etc).
Zip all files or submit all files at once. This should be in report format.
Prepare a demonstration of your project. This should be done in PowerPoint format, 15-20 slides are required.
assignment instructions: Use python for the assignment as mandatory. 1. Remember
assignment instructions: Use python for the assignment as mandatory.
1. Remember
assignment instructions: Use python for the assignment as mandatory.
1. Remember to include a README file with detailed explanations of your code’s steps, executions, inputs, and outputs. 2. Make sure to specify the input folder path in a way that can be used on any machine, not just your local system, even if it’s mentioned in the README file. 3. If you make any changes to the input data files, don’t forget to include the newly created files in your zip folder. 4. All scripts should be submitted in a suitable format such as .py, .ipynb, .R, .Rmd, etc. 5. If you receive any output files like heatmaps, figures, or plots, please include them in your zip folder along with your code.
GIVE ME ALL THE REQUIRED FILES ASKED IN THE INSTRUCTIONS.
assignment instructions: Use python for the assignment as mandatory. 1. Remember
assignment instructions: Use python for the assignment as mandatory.
1. Remember
assignment instructions: Use python for the assignment as mandatory.
1. Remember to include a README file with detailed explanations of your code’s steps, executions, inputs, and outputs. 2. Make sure to specify the input folder path in a way that can be used on any machine, not just your local system, even if it’s mentioned in the README file. 3. If you make any changes to the input data files, don’t forget to include the newly created files in your zip folder. 4. All scripts should be submitted in a suitable format such as .py, .ipynb, .R, .Rmd, etc. 5. If you receive any output files like heatmaps, figures, or plots, please include them in your zip folder along with your code.
GIVE ME ALL THE REQUIRED FILES ASKED IN THE INSTRUCTIONS.