Question
An ARFF (Attribute-Relation File Format) file is an ASCII text file that describes a list of instances sharing a set of attributes. You have been
- An ARFF (Attribute-Relation File Format) file is an ASCII text file that describes a list of instances sharing a set of attributes. You have been provided the file "weather.arff" that contains a description of weather data. The line that starts with "@relation" describes the relation name. The lines that start with "@attribute" describes each attribute name and its possible values. The lines after "@data" are the data instances. Each data instance consists of a set of attribute values separated by a comma (,) with the order of attributes matching the order of attribute names described by "@attribute" lines.
- You are provided an incomplete program called processweather.py. Fill the missing code inside the function affDict that takes an ARFF file as input and returns all the data instances into a list of dictionaries so that it looks something like:
- [{'windy': 'FALSE', 'play': 'no', 'temperature': '85', 'outlook': 'sunny', 'humidity': '85'}, ... , {'windy': 'TRUE', 'play': 'no', 'temperature': '71', 'outlook': 'rainy', 'humidity': '91'}]. No for loops is allowed in this function.
- Inside the main function, after reading in the information into a list of dictionaries, ask the user if they are interested in windy or non-windy days and print information related to those days. Fill the missing code here. Your program should match the output (very very closely) of the below example. Note: your program should force the user to enter "w" or "W" or "n" or "N" and not accept
any other response.
Would you like information about [W]indy days or [N]on-windy days? blah Would you like information about [W]indy days or [N]on-windy days? windy Would you like information about [W]indy days or [N]on-windy days? w --There are 6 matching days--
Day 1 temperature: 80 outlook: sunny Day 2 temperature: 65 outlook: rainy Day 3 temperature: 64 outlook: overcast Day 4 temperature: 75 outlook: sunny Day 5 temperature: 72 outlook: overcast Day 6 temperature: 71 outlook: rainy
here is the data file name weather.arff
@relation weather
@attribute outlook {sunny, overcast, rainy}
@attribute temperature real
@attribute humidity real
@attribute windy {TRUE, FALSE}
@attribute play {yes, no}
@data
sunny,85,85,FALSE,no
sunny,80,90,TRUE,no
overcast,83,86,FALSE,yes
rainy,70,96,FALSE,yes
rainy,68,80,FALSE,yes
rainy,65,70,TRUE,no
overcast,64,65,TRUE,yes
sunny,72,95,FALSE,no
sunny,69,70,FALSE,yes
rainy,75,80,FALSE,yes
sunny,75,70,TRUE,yes
overcast,72,90,TRUE,yes
overcast,81,75,FALSE,yes
rainy,71,91,TRUE,no
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started