Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
import csv
hypo = []
data = []
temp = []
with open('datasets/2.csv') as csv_file:
lines = csv.reader(csv_file)
for line in lines:
temp.append(line)
if line[-1] == 'Y':
data.append(line)
print('Attributes')
print(temp[0])
Attributes
['Sky', 'AirTemp', 'Humidity', 'Wind', 'Water', 'Forecast', 'EnjoySport']
temp = temp[1:]
print('Dataset')
for line in temp:
print(line)
Dataset
['sunny', 'warm', 'normal', 'strong', 'warm', 'same', 'Y']
['sunny', 'warm', 'high', 'strong', 'warm', 'same', 'Y']
['rainy', 'cold', 'high', 'strong', 'warm', 'change', 'N']
['sunny', 'warm', 'high', 'strong', 'cool', 'change', 'Y']
print('Positive Examples')
for line in data:
print(line)
Positive Examples
['sunny', 'warm', 'normal', 'strong', 'warm', 'same', 'Y']
['sunny', 'warm', 'high', 'strong', 'warm', 'same', 'Y']
['sunny', 'warm', 'high', 'strong', 'cool', 'change', 'Y']