Skip to content

AttributeError: 'DataFrame' object has no attribute 'name' #666

Closed
@islrnd

Description

@islrnd
AttributeError                            Traceback (most recent call last)
<ipython-input-32-8d38637b6cc6> in <module>
      6 
      7 oversampler=SMOTE(random_state=42)
----> 8 smote_train, smote_target = oversampler.fit_resample(X,y)
      9 
     10 print("Before OverSampling, counts of label '0', '1':", smote_target['label'].value_counts())

~\Anaconda3\lib\site-packages\imblearn\base.py in fit_resample(self, X, y)
     73         """
     74         check_classification_targets(y)
---> 75         X, y, binarize_y = self._check_X_y(X, y)
     76 
     77         self.sampling_strategy_ = check_sampling_strategy(

~\Anaconda3\lib\site-packages\imblearn\base.py in _check_X_y(self, X, y, accept_sparse)
    148         if hasattr(y, "loc"):
    149             # store information to build a series
--> 150             self._y_name = y.name
    151             self._y_dtype = y.dtype
    152         else:

~\Anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
   5065             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5066                 return self[name]
-> 5067             return object.__getattribute__(self, name)
   5068 
   5069     def __setattr__(self, name, value):

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions