AttributeError: module 'pandas' has no attribute 'get_dummes'

Question:

I follow documentation here: https://pandas.pydata.org/docs/reference/api/pandas.get_dummies.html and I would like to create dummies using get_dummes()
My code:

mydf.get_dummes(mydf, columns = ['payment_id'])

but I get an error AttributeError: 'DataFrame' object has no attribute 'get_dummes'. I use pandas 1.3.4. Why?

Asked By: vojta

||

Answers:

I think it supposed to be get_dummies(). There is a typo in your method

Answered By: reppon

I do get that error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [7], in <cell line: 8>()
      5 y = df['dif']
      7 # Create dummy variables for the 'region' and 'pillar' columns
----> 8 X = X.get_dummies(df, columns=['Customer Region', 'Pillar'])
      9 X = X.drop(columns=['Customer Region', 'Pillar'])
     11 # Get the list of column names

File ~/opt/anaconda3/lib/python3.9/site-packages/pandas/core/generic.py:5575, in NDFrame.__getattr__(self, name)
   5568 if (
   5569     name not in self._internal_names_set
   5570     and name not in self._metadata
   5571     and name not in self._accessors
   5572     and self._info_axis._can_hold_identifiers_and_holds_name(name)
   5573 ):
   5574     return self[name]
-> 5575 return object.__getattribute__(self, name)

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

Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.