Skip to content

Commit fed6380

Browse files
authored
fix(lib): Apply mappings before removing headers (#66)
* 🌋🌈 Updated with Glitch * 📟🖇 Updated with Glitch Co-authored-by: Glitch (isair-tensorflow-load-csv) <none>
1 parent 7a03239 commit fed6380

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/loadCsv.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,18 @@ const loadCsv = (filename: string, options: CsvReadOptions) => {
3535
})
3636
);
3737

38+
const mappedData = applyMappings(data, mappings);
39+
3840
const tables: { [key: string]: CsvTable } = {
39-
labels: filterColumns(data, labelColumns),
40-
features: filterColumns(data, featureColumns),
41+
labels: filterColumns(mappedData, labelColumns),
42+
features: filterColumns(mappedData, featureColumns),
4143
testFeatures: [],
4244
testLabels: [],
4345
};
4446

4547
tables.labels.shift();
4648
tables.features.shift();
4749

48-
for (const key of Object.keys(tables)) {
49-
tables[key] = applyMappings(tables[key], mappings);
50-
}
51-
5250
if (shouldShuffle) {
5351
const seed =
5452
typeof shouldShuffle === 'string' ? shouldShuffle : defaultShuffleSeed;

0 commit comments

Comments
 (0)