Closed savioricardog closed 1 year ago
I also observed this bug. Fine after downgrading to numpy < 1.24 , as workaround do pip install numpy=1.23.4
or mamba install numpy=1.23.4
, as with this version of numpy many new deprecations took place, see also release notes: https://github.com/numpy/numpy/releases/tag/v1.24.0
The bug here IMHO is, that sweetviz hasn't updated to this behaviour yet.
You can use the latest numpy with this fix: https://github.com/fbdesignpro/sweetviz/pull/131#issuecomment-1401394461
@savioricardog @thomasmooon @frank1010111 thank you for reporting and mentioning workarounds. I am currently on break for the next few days but will be investigating this upon my return, hopefully we can fix this quickly.
Thanks again for reporting this, should be fixed with the latest version 2.2.1! Please let us know if you run into anything else with the latest version.
@fbdesignpro, I encountered the following error: "AttributeError: module 'numpy' has no attribute 'VisibleDeprecationWarning'" while attempting to use sweetviz==2.3.1
and numpy==2.0.1
.
@mingjun1120 Same here. Got it working with numpy = "<2.0.0"
Thank you for catching that. It appears that numpy 2 has permanently moved VisibleDeprecationWarning
to numpy.exceptions
. I'm testing a fix.
Acredito que contenha um erro no arquivo 'graph_numeric', Pois estava ocorrendo este erro e após eu alterar o arquivo Disso: 70 "np.warnings.filterwarnings('ignore', category=np.VisibleDeprecationWarning) 71 self.hist_specs = axs.hist(plot_data, weights = normalizing_weights, bins=self.num_bins, \ 72 rwidth = (100.0 - gap_percent) / 100.0) 73 np.warnings.filterwarnings('once', category=np.VisibleDeprecationWarning)"
Para isso: "import warnings warnings.filterwarnings('ignore', category=np.VisibleDeprecationWarning) self.hist_specs = axs.hist(plot_data, weights = normalizing_weights, bins=self.num_bins, \ rwidth = (100.0 - gap_percent) / 100.0) warnings.filterwarnings('once', category=np.VisibleDeprecationWarning)"
Resolveu o problema descrito abaixo.
Feature: HOME_FG |█▉ | [ 19%] 00:00 -> (00:02 left)
AttributeError Traceback (most recent call last) Cell In[18], line 1 ----> 1 report = sv.analyze(data) 2 report.show_html()
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sweetviz\sv_public.py:12, in analyze(source, target_feat, feat_cfg, pairwise_analysis) 8 def analyze(source: Union[pd.DataFrame, Tuple[pd.DataFrame, str]], 9 target_feat: str = None, 10 feat_cfg: FeatureConfig = None, 11 pairwise_analysis: str = 'auto'): ---> 12 report = sweetviz.DataframeReport(source, target_feat, None, 13 pairwise_analysis, feat_cfg) 14 return report
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sweetviz\dataframe_report.py:256, in DataframeReport.init(self, source, target_feature_name, compare, pairwise_analysis, fc) 253 for f in features_to_process: 254 # start = time.perf_counter() 255 self.progress_bar.set_description_str(f"Feature: {f.source.name}") --> 256 self._features[f.source.name] = sa.analyze_feature_to_dictionary(f) 257 self.progress_bar.update(1) 258 # print(f"DONE FEATURE------> {f.source.name}" 259 # f" {(time.perf_counter() - start):.2f} {self._features[f.source.name]['type']}") 260 # self.progress_bar.set_description_str('[FEATURES DONE]') 261 # self.progress_bar.close() 262 263 # Wrap up summary
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sweetviz\series_analyzer.py:136, in analyze_feature_to_dictionary(to_process) 134 # Perform full analysis on source/compare/target 135 if returned_feature_dict["type"] == FeatureType.TYPE_NUM: --> 136 sweetviz.series_analyzer_numeric.analyze(to_process, returned_feature_dict) 137 elif returned_feature_dict["type"] == FeatureType.TYPE_CAT: 138 sweetviz.series_analyzer_cat.analyze(to_process, returned_feature_dict)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sweetviz\series_analyzer_numeric.py:101, in analyze(to_process, feature_dict) 97 do_stats_numeric(to_process.compare, compare_dict) 99 do_detail_numeric(to_process.source, to_process.source_counts, to_process.compare_counts, feature_dict) --> 101 feature_dict["minigraph"] = GraphNumeric("mini", to_process) 102 feature_dict["detail_graphs"] = list() 103 for num_bins in [0, 5, 15, 30]:
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sweetviz\graph_numeric.py:70, in GraphNumeric.init(self, which_graph, to_process) 66 normalizing_weights = norm_source 68 gap_percent = config["Graphs"].getfloat("summary_graph_categorical_gap") ---> 70 np.warnings.filterwarnings('ignore', category=np.VisibleDeprecationWarning) 71 self.hist_specs = axs.hist(plot_data, weights = normalizing_weights, bins=self.num_bins, \ 72 rwidth = (100.0 - gap_percent) / 100.0) 73 np.warnings.filterwarnings('once', category=np.VisibleDeprecationWarning)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy__init.py:320, in getattr(attr) 317 from .testing import Tester 318 return Tester --> 320 raise AttributeError("module {!r} has no attribute " 321 "{!r}".format(name__, attr))
AttributeError: module 'numpy' has no attribute 'warnings'