Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
MATH6005 Final Assignment
1 Instructions
Your final Assignment will count for 80% of the assessment for MATH6005. The deadline is
23:59 on Friday 23/04/2021. The deadline is strict. Assignments handed in after this time
is not allowed, except where special considerations apply. Ensure that you take frequent and
multiple backups of your work, since excuses concerning lost or corrupted files will not be
treated sympathetically. Please, verify that you follow all instructions carefully and your work
has been uploaded successfully.
1.1 Submission
Same as the Mid-module Assignment, we accept submissions through https://repl.it/.
You must NOT delete any code in the ‘main.py’ file. All default code is useful to submit
and mark your assignment. There are four built-in functions in the ‘main.py’ file. You
must NOT change their names, keyword arguments and returns. You are expected to
add code to complete these functions.
1.2 Collaboration, plagiarism and cheating
You should work on your own when carrying out the assignment.
Please refresh your memory of the University’s code on academic integrity, see
University of Southampton Calendar 2020/21
Please note that allowing somebody else to copy your work is counted as plagiarism: it
carries the same penalty as copying work.
Submissions will be strictly tested for plagiarism with specialised software and penalties
strictly enforced.
1.3 Purpose of assessment
The purpose of this assignment is to assess your ability to:
Write a structured computer program.
Demonstrate good programming practice, as discussed in the course notes, lectures and
computer workshops.
Demonstrate good and correct use of Python.
2 Assignments
The assignment consists of four Tasks.
1
Task 1 (20%)
You are given a data set of the US weather history (Task1 USweather history.txt) for one
year (1/7/2014-30/6/2015). Your task is to
1.1 Find the hottest day in terms of actual max temp;
1.2 Find the coldest day in terms of actual min temp;
1.3 Find mean temperature of months in terms of actual mean temp;
1.4 Find mean temperature of weeks in terms of actual mean temp. (Note that one week is
from Sunday to Monday. Therefore, the first week and the last week do not have 7 days.)
Task 2 (20%)
You are given a spending sheet in a csv file, Task2 Expenses by client.csv, including (name
of users, date from 2020/1/1 to 2020/6/15, spending). User names are unique. For each user,
your task is to
2.1 Find the dates in which the user spends more than the previous day and the next day.
2.2 Find the dates in which the user spends more than the 7 days before or the 7 days after.
There is no data of 7 dates before 2020/1/1 and no data of 7 next dates after 2020/6/15. But,
we assume that the expenses for these 14 days are 1000000 so that each date from 2020/1/1 to
2020/6/15 should be taken into consideration for Tasks 2.1 and 2.2.
Task 3 (20%)
Given a text document, Task3_rand_words_text.txt, your task is to
3.1 Count the frequency of words appearing in the text. The data should be sorted by the
frequency in a decreasing order. For those words with the same frequency, they should
be ordered by their first letters also in decreasing order.
3.2 Rewrite the text as a sequence of numbers representing the order of the word frequency.
For example: suppose the given text is
cat may car dog may car cat cat dog may dog dog
Then the outcome of Task 3.1 is a dataframe, i.e.,
Word Frequency
0 dog 4
1 may 3
2 cat 3
3 car 2
Here, may and cat have the frequency 3. They are ordered by the first letters m, c in decreasing
order, which results in may, cat rather than cat, may. The outcome of Task 3.2 is a list, i.e.,
[2, 1, 3, 0, 1, 3, 2, 2, 0, 1, 0, 0]
2
Task 4 (20%)
You are given a list of transactions in a csv file, Task4 Transactions, consisting of: out
account, in account, amount, i.e., there are transactions from out account to in account with
the given amount. Your task is to reduce or change the transferred amounts between accounts
to minimize the total transferred money. For example: suppose the given csv file is
out account in account (£) amount
A B 10
B C 6
C A 7
The second line above means that A transfers £10 to B. The outcome of this Task should be
out account in account (£) amount
A B 4
C A 1
Note that you can only change or reduce the amounts of existing transactions, and cannot
create new ones. For the above simple example, there are three existing transactions: A →
B,B→ C,C→ A, therefore, you cannot create transactions like C→ B or B→ A. Moreover,
your code should work for not only the above simple example, but also for any given number of
accounts and transactions. For example, we may test your code with a data of 1000 accounts
and 3000 transactions between them.
3 Hints
You would need to use materials taken from lectures and computer labs for this Assignment.
You can use any built-in function from numpy and pandas.