fbdesignpro/sweetviz

AttributeError: 'DataFrame' object has no attribute 'iteritems'

mingjun1120 opened this issue · 3 comments

In Pandas 2.0, .iteritems function is removed. Someone needs to updates the code to make it fit the latest Pandas version.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[~\AppData\Local\Temp\ipykernel_11256\2414433140.py](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/ILLEGEAR/OneDrive/Desktop/Data%20Science%20360/~/AppData/Local/Temp/ipykernel_11256/2414433140.py) in ?()
      1 # Using sweetwiz to generate report
      2 # import warnings
      3 # warnings.filterwarnings('ignore')
      4 
----> 5 sweet_report = sv.analyze(source=df, target_feat='left')
      6 sweet_report.show_notebook(w="100%", h="Full", layout='vertical')

[c:\Users\ILLEGEAR\OneDrive\Desktop\Data](file:///C:/Users/ILLEGEAR/OneDrive/Desktop/Data) Science 360\.venv\lib\site-packages\sweetviz\sv_public.py in ?(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

[c:\Users\ILLEGEAR\OneDrive\Desktop\Data](file:///C:/Users/ILLEGEAR/OneDrive/Desktop/Data) Science 360\.venv\lib\site-packages\sweetviz\dataframe_report.py in ?(self, source, target_feature_name, compare, pairwise_analysis, fc)
     70             source_df = source_df.rename(columns={"index": "df_index"})
     71             if target_feature_name == 'index':
     72                 target_feature_name = 'df_index'
     73 
---> 74         all_source_names = [cur_name for cur_name, cur_series in source_df.iteritems()]
...
   5987         ):
   5988             return self[name]
-> 5989         return object.__getattribute__(self, name)

AttributeError: 'DataFrame' object has no attribute 'iteritems'

@mingjun1120 thank you, update coming up shortly!!

I observed sweetviz.analyze() works great with pandas 1.5.3 but not with pandas 2.0.1

I get error on pandas 2.0.1, sweetviz 2.1.4, python 3.11.2
'DataFrame' object has no attribute 'iteritems'. Did you mean: 'isetitem'?

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.