Missing data in a dataset is the most common problems faced by…

Question Answered step-by-step Missing data in a dataset is the most common problems faced by… Missing data in a dataset is the most common problems faced by analysts before they start their analysis. The common ways of handle missing data are: • delete the missing data • fill the missing data with the appropriate values In this question, we will formulate a function to clean up missing data that are denoted by NaN.  (a) Write a function clean_up_data(data, method) that will take in a dataset data which will be cleaned up according to the method selected by the user. method can take either value of {“delete”, “replace”}. When method = “delete” is selected by the user, a truncated data set is returned by the function, in the event of missing data. When method = “replace” is selected by the user, the missing data is replaced by taking the average value of the data points adjacent to missing data. You can only replace the missing data with the average value if and only if the adjacent data points are valid data. If you cannot calculate the average neighboring data, the missing data is replaced by the adjacent data which has a valid value. State any assumptions, if any, you have made in your function implementation. Image transcription text(b) Use your function on the test cases: Test Case data method [1, 2, NaN, 4, 5] replace 2 [1, 2, NaN, 4, 5]delete 3 [1, 2, 3, 4, NaN] replace 4 [NaN, 2, 3, 4, NaN] replace 5 [1, 2, NaN, NaN, 5] replace 6 [NaN, NaN, 3, 4, 5]replace 7 [1, 2, 3, NaN, NaN] replace 8 [NaN, NaN, NaN, NaN, NaN] delete For each of the test cas… Show more… Show more Computer Science Engineering & Technology Python Programming BUSINESS 342 Share QuestionEmailCopy link Comments (0)

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now