function categoryMaps(categorical) {
let indexToCat = {};
let catToIndex = {};
let dimensions = getDimensions(categorical);
for (let dim of dimensions) {
indexToCat[dim] = [];
catToIndex[dim] = new Map();
}
for (let row of categorical) {
for (let dim of dimensions) {
if (!catToIndex[dim].has(row[dim])) {
catToIndex[dim].set(row[dim], indexToCat[dim].length);
indexToCat[dim].push(row[dim]);
}
}
}
return { indexToCat, catToIndex };
}