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: Resolve the issue of conflicts between columns added during the analysis process and the original data columns in the Spark version. #1518

Merged
merged 3 commits into from
May 6, 2024
Merged
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: 7 additions & 1 deletion src/ydata_profiling/model/spark/summary_spark.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,25 @@ def multiprocess_1d(args: tuple) -> Tuple[str, dict]:
column, df = args
return column, describe_1d(config, df.select(column), summarizer, typeset)

# Rename the df column names to prevent potential conflicts
for col in df.columns:
df = df.withColumnRenamed(col, f"{col}_customer")

args = [(name, df) for name in df.columns]
with multiprocessing.pool.ThreadPool(12) as executor:
for i, (column, description) in enumerate(
executor.imap_unordered(multiprocess_1d, args)
):
if column.endswith("_customer"):
column = column[:-9]
pbar.set_postfix_str(f"Describe variable:{column}")

# summary clean up for spark
description.pop("value_counts")

series_description[column] = description
pbar.update()
series_description = {k: series_description[k] for k in df.columns}
series_description = {k[:-9]: series_description[k[:-9]] for k in df.columns}

# Mapping from column name to variable type
series_description = sort_column_names(series_description, config.sort)
Expand Down
Loading