Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eda): fixed uncaught dtype exceptions #607

Merged
merged 1 commit into from
Apr 28, 2021
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
14 changes: 14 additions & 0 deletions dataprep/eda/create_report/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
Continuous,
DateTime,
Nominal,
GeoGraphy,
detect_dtype,
is_dtype,
)
Expand Down Expand Up @@ -127,6 +128,8 @@ def format_basic(df: dd.DataFrame, cfg: Config) -> Dict[str, Any]:
ins = _format_cont_ins(col, dat, data["ov"]["nrows"], cfg)[1]
elif is_dtype(dtp, Nominal()):
ins = _format_nom_ins(col, dat, data["ov"]["nrows"], cfg)[1]
elif is_dtype(dtp, GeoGraphy()):
ins = _format_nom_ins(col, dat, data["ov"]["nrows"], cfg)[1]
else:
continue
all_ins += ins
Expand All @@ -150,6 +153,11 @@ def format_basic(df: dd.DataFrame, cfg: Config) -> Dict[str, Any]:
stats = format_cat_stats(
data[col]["stats"], data[col]["len_stats"], data[col]["letter_stats"]
)
elif is_dtype(detect_dtype(df[col]), GeoGraphy()):
itmdt = Intermediate(col=col, data=data[col], visual_type="categorical_column")
stats = format_cat_stats(
data[col]["stats"], data[col]["len_stats"], data[col]["letter_stats"]
)
elif is_dtype(detect_dtype(df[col]), DateTime()):
itmdt = Intermediate(
col=col,
Expand Down Expand Up @@ -268,6 +276,8 @@ def basic_computations(
data[col] = nom_comps(df.frame[col], df.frame[col].head(), cfg)
elif is_dtype(detect_dtype(df.frame[col]), Nominal()):
data[col] = nom_comps(df.frame[col], first_rows[col], cfg)
elif is_dtype(detect_dtype(df.frame[col]), GeoGraphy()):
data[col] = nom_comps(df.frame[col], first_rows[col], cfg)
elif is_dtype(detect_dtype(df.frame[col]), Continuous()):
data[col] = cont_comps(df.frame[col], cfg)
elif is_dtype(detect_dtype(df.frame[col]), DateTime()):
Expand All @@ -289,6 +299,10 @@ def basic_computations(
data["insights"].append(
(col, Nominal(), _nom_calcs(df.frame[col].dropna(), head[col], cfg))
)
elif is_dtype(col_dtype, GeoGraphy()):
data["insights"].append(
(col, Nominal(), _nom_calcs(df.frame[col].dropna(), head[col], cfg))
)
elif is_dtype(col_dtype, DateTime()):
data["insights"].append(
(col, DateTime(), dask.delayed(_calc_line_dt)(df.frame[[col]], cfg.line.unit))
Expand Down
12 changes: 5 additions & 7 deletions dataprep/eda/create_report/templates/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,17 @@
for (let i of element) {
let thValue = i.firstElementChild.innerText;
let tbValue = i.lastElementChild.innerText;
if (thValue.includes('Distinct') && tbValue > 50) {
i.style.color = color;
} else if (thValue.includes('Unique') && tbValue.replace('%',
'') == 100) {
if (thValue.includes('Unique') && tbValue.replace('%',
'') == 100) {
i.style.color = color;
} else if (thValue.includes('Missing') && tbValue.replace('%',
'') != 0) {
'') != 0) {
i.style.color = color;
} else if (thValue.includes('Zeros') && tbValue.replace('%',
'') != 0) {
'') != 0) {
i.style.color = color;
} else if (thValue.includes('Infinite') && tbValue.replace('%',
'') != 0) {
'') != 0) {
i.style.color = color;
} else if (thValue.includes('Skewness' && tbValue > 20)) {
i.style.color = color;
Expand Down