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

Commit

Permalink
Bool values are not numeric (#51)
Browse files Browse the repository at this point in the history
Co-authored-by: danthe3rd <danthe3rd@users.noreply.github.com>
  • Loading branch information
danthe3rd and danthe3rd committed Apr 14, 2020
1 parent 4f91284 commit 3fddaa9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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

0 comments on commit 3fddaa9

Please sign in to comment.