Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

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...

1 answer below »

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 XXXXXXXXXXUse two script arguments, the full path fi lename of

the input fi le and an output directory.

Example input: C:/gispy/data/ch19/wheatYield.txt C:/gispy/scratch/

Example output:

>>> Number of records with errors is: 10

Corrected file is: C:/gispy/scratch/wheatYield_edited.txt

Answered 96 days After Jan 04, 2022

Solution

Sathishkumar answered on Apr 11 2022
106 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here