removeLines.py Write a script to read the ‘wheatYield.txt’ sample dataset, remove invalid records, and write the results to an output text fi le. The output fi le should be named...

removeLines.py Write a script to read the ‘wheatYield.txt’ sample dataset, remove invalid records, and write the results to an output text fi le. The output fi le should be named ‘wheatYield_edited.txt’ and created as described here. Figure 19.3 shows the fi rst six rows of the dataset which contains wheat yield samples collected at various sites between June 2000 and July 2002. The fi rst line of the fi le contains the dates. The values in each record are separated by spaces. Some records contain errors: all values should be positive and each record should contain eight sample wheat yields, but some entries are missing or negative. None of the site numbers are missing, so you can check for missing values by checking the length of the list of items in each record against the number of fi elds. Any sites with invalid data entries should be removed. For example, the errors shown in Figure 19.3 mean that sites 2 and 4 should be removed, as in Figure 19.4 . Use two script arguments, the full path fi lename of the input fi le and an output directory.

Apr 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here