force categorical treatment of user annotations (#1663)

This commit is contained in:
Bruce Martin
2020-07-22 17:02:19 -07:00
committed by GitHub
parent 03bad04436
commit 83d572cde2
5 changed files with 39 additions and 20 deletions
+7 -1
View File
@@ -66,7 +66,12 @@ export function _isContinuousType(schema) {
export function _normalizeCategoricalSchema(colSchema, col) {
const { type, writable } = colSchema;
if (type === "string" || type === "boolean" || type === "categorical") {
if (
type === "string" ||
type === "boolean" ||
type === "categorical" ||
writable
) {
const categorySet = new Set(
col.summarizeCategorical().categories.concat(colSchema.categories ?? [])
);
@@ -79,4 +84,5 @@ export function _normalizeCategoricalSchema(colSchema, col) {
if (colSchema.categories) {
colSchema.categories = catLabelSort(writable, colSchema.categories);
}
return colSchema;
}