From 30c6e711c6e785129dbb261888f7ef122fe863ef Mon Sep 17 00:00:00 2001 From: Ilia Kaftanov Date: Wed, 16 Oct 2024 18:14:31 +0300 Subject: [PATCH] fix: stop updating n_samples on iterations (1 sample on first iter leads to 1 sample for each following columns) --- lida/components/summarizer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lida/components/summarizer.py b/lida/components/summarizer.py index f48b89da..a91929d5 100644 --- a/lida/components/summarizer.py +++ b/lida/components/summarizer.py @@ -78,9 +78,9 @@ def get_column_properties(self, df: pd.DataFrame, n_samples: int = 3) -> list[di nunique = df[column].nunique() if "samples" not in properties: non_null_values = df[column][df[column].notnull()].unique() - n_samples = min(n_samples, len(non_null_values)) + num_samples = min(n_samples, len(non_null_values)) samples = pd.Series(non_null_values).sample( - n_samples, random_state=42).tolist() + num_samples, random_state=42).tolist() properties["samples"] = samples properties["num_unique_values"] = nunique properties["semantic_type"] = ""