Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

pd.get_dummies why use drop_first

Babylonian Ho answered on May 4, 2023 Popularity 3/10 Helpfulness 1/10

Contents


More Related Answers

  • pandas print duplicate rows
  • drop duplicates pandas first column
  • getting dummies for a column in pandas dataframe
  • remove duplicate row in df
  • pandas drop duplicate keep last
  • get dummies pandas
  • how to get dummies in a dataframe pandas
  • drop duplicate index pandas
  • pandas drop duplicates from column
  • pandas drop duplicates
  • get_dummies
  • get_dummies in python
  • pd.get_dummies
  • pd drop duplicate columns
  • remove duplicates index pandas
  • df index drop duplicates
  • drop duplicates data frame pandas python
  • get dummies pandas
  • get dummies pandas
  • pd.get_dummies numerical
  • drop_duplicates
  • drop duplicates columns pandas
  • pd df drop duplicates
  • remove duplicate rows in pandas
  • pandas remove duplicates

  • pd.get_dummies why use drop_first

    0

    To encode categorical data, one hot encoding is done, where a dummy variable is to be created for each discrete categorical variable for a feature. This can be done by using pandas.get_dummies() which will return dummy-coded data. Here we use parameter drop_first = True, this will drop the first dummy variable, thus it will give n-1 dummies out of n discrete categorical levels by removing the first level.

    If we do not use drop_first = True, then n dummy variables will be created, and these predictors(n dummy variables) are themselves correlated which is known as multicollinearity and it, in turn, leads to Dummy Variable Trap

    Popularity 3/10 Helpfulness 1/10 Language python
    Source: Grepper
    Tags: python
    Link to this answer
    Share Copy Link
    Contributed on May 04 2023
    Babylonian Ho
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.