Datasets:
Tasks:
Tabular Classification
Modalities:
Tabular
Formats:
csv
Languages:
English
Size:
10K - 100K
License:
Upload page_blocks.py
Browse files- page_blocks.py +5 -1
page_blocks.py
CHANGED
@@ -102,13 +102,17 @@ class PageBlocks(datasets.GeneratorBasedBuilder):
|
|
102 |
def preprocess(self, data: pandas.DataFrame) -> pandas.DataFrame:
|
103 |
if self.config.name == "page_blocks_binary":
|
104 |
data["number_of_transitions"] = data["number_of_transitions"].apply(lambda x: 1 if x > 1 else 0)
|
|
|
105 |
data = data.rename(columns={"number_of_transitions": "has_multiple_transitions"})
|
|
|
106 |
|
|
|
107 |
for feature in _ENCODING_DICS:
|
108 |
encoding_function = partial(self.encode, feature)
|
|
|
109 |
data.loc[:, feature] = data[feature].apply(encoding_function)
|
|
|
110 |
|
111 |
-
print("read\n\n\n\n")
|
112 |
|
113 |
return data[list(features_types_per_config[self.config.name].keys())]
|
114 |
|
|
|
102 |
def preprocess(self, data: pandas.DataFrame) -> pandas.DataFrame:
|
103 |
if self.config.name == "page_blocks_binary":
|
104 |
data["number_of_transitions"] = data["number_of_transitions"].apply(lambda x: 1 if x > 1 else 0)
|
105 |
+
print("mapped\n\n\n\n")
|
106 |
data = data.rename(columns={"number_of_transitions": "has_multiple_transitions"})
|
107 |
+
print("renamed\n\n\n\n")
|
108 |
|
109 |
+
print("encoding\n\n\n\n")
|
110 |
for feature in _ENCODING_DICS:
|
111 |
encoding_function = partial(self.encode, feature)
|
112 |
+
print("\tencoding...\n\n\n\n")
|
113 |
data.loc[:, feature] = data[feature].apply(encoding_function)
|
114 |
+
print("encoded\n\n\n\n")
|
115 |
|
|
|
116 |
|
117 |
return data[list(features_types_per_config[self.config.name].keys())]
|
118 |
|