Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Bool values are not numeric #51

Merged
merged 1 commit into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions hiplot/fetchers_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ def demo_distribution(**kwargs: Any) -> hip.Experiment:
return xp


def demo_bool() -> hip.Experiment:
return hip.Experiment.from_iterable([
{"bool": True},
{"bool": False}
])


README_DEMOS: Dict[str, Callable[[], hip.Experiment]] = {
"demo": demo,
"demo_big": lambda: demo(1000),
Expand All @@ -163,4 +170,5 @@ def demo_distribution(**kwargs: Any) -> hip.Experiment:
"demo_distribution_cat": lambda: demo_distribution(axis="cat"),
"demo_distribution_num": lambda: demo_distribution(axis="numeric"),
"demo_distribution_num_100bins": lambda: demo_distribution(axis="numeric", nbins=100),
"demo_bool": demo_bool,
}
4 changes: 3 additions & 1 deletion src/infertypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ export function infertypes(url_states: PersistentState, table: Array<Datapoint>,
} else {
setVals.push(v);
}
if (typeof v != "number" && !is_special_num && isNaN(v)) {
// Detect non-numeric column
if ((typeof v != "number" && !is_special_num && isNaN(v)) ||
v === true || v === false) {
numeric = false;
return;
}
Expand Down