mstz commited on
Commit
62ebac0
·
1 Parent(s): 9f411b5

Update golf.py

Browse files
Files changed (1) hide show
  1. golf.py +2 -14
golf.py CHANGED
@@ -72,7 +72,7 @@ class Golf(datasets.GeneratorBasedBuilder):
72
  ]
73
 
74
  def _generate_examples(self, filepath: str):
75
- data = pandas.read_csv(filepath, header=None)
76
  data = self.preprocess(data)
77
 
78
  for row_id, row in data.iterrows():
@@ -80,19 +80,7 @@ class Golf(datasets.GeneratorBasedBuilder):
80
 
81
  yield row_id, data_row
82
 
83
- def preprocess(self, data: pandas.DataFrame) -> pandas.DataFrame:
84
- data.columns = [
85
- "outlook",
86
- "temperature",
87
- "humidity",
88
- "windy",
89
- "goodPlaying",
90
- "toPlay"
91
- ]
92
- print(data.head())
93
- print("toPlay" in data.columns)
94
- print("toPlay" in _ENCODING_DICS)
95
-
96
  for feature in _ENCODING_DICS:
97
  encoding_function = partial(self.encode, feature)
98
  data.loc[:, feature] = data[feature].apply(encoding_function)
 
72
  ]
73
 
74
  def _generate_examples(self, filepath: str):
75
+ data = pandas.read_csv(filepath)
76
  data = self.preprocess(data)
77
 
78
  for row_id, row in data.iterrows():
 
80
 
81
  yield row_id, data_row
82
 
83
+ def preprocess(self, data: pandas.DataFrame) -> pandas.DataFrame:
 
 
 
 
 
 
 
 
 
 
 
 
84
  for feature in _ENCODING_DICS:
85
  encoding_function = partial(self.encode, feature)
86
  data.loc[:, feature] = data[feature].apply(encoding_function)