dummy-variable

Create dummy column and input value from other column

Create dummy column and input value from other column Question: I have data containing a list of topics (topics 1-5; and 0 meaning no topic is assigned) and their value. I want to create a new column for each topic and fill the column with the value. Here’s what the table looks like… reviewId topic …

Total answers: 2

Create a dummy based on other variables in Python

Create a dummy based on other variables in Python Question: I have three columns dummy variables, ‘dummy1’, ‘dummy2’ and ‘dummy3. I would like to create a new column with a new dummy, ‘new_dummy’, with 1 if at least one of dummies of before has a value 1. I am using python. I have in mind …

Total answers: 1

From Dummy to a List pandas

From Dummy to a List pandas Question: I have a dataframe with many dummy variables. Instead of having a lot of different dummy columns, I want only one column and each row needs to contain a string with only the dummy variable equal to 1. index a b c 0 1 1 1 1 0 …

Total answers: 2

Creating a regression model using Day of Week, Hour of Day, and Type of Media?

Creating a regression model using Day of Week, Hour of Day, and Type of Media? Question: Working with Python 3 in a Jupyter notebook. I am trying to create a regression model (equation?) to predict the Eng as % of Followers variable. I’d be given Media Type, Hour Created, and Day of Week. These should …

Total answers: 1

Dummy variables when not all categories are present

Dummy variables when not all categories are present Question: I have a set of dataframes where one of the columns contains a categorical variable. I’d like to convert it to several dummy variables, in which case I’d normally use get_dummies. What happens is that get_dummies looks at the data available in each dataframe to find …

Total answers: 11

What are the pros and cons between get_dummies (Pandas) and OneHotEncoder (Scikit-learn)?

What are the pros and cons between get_dummies (Pandas) and OneHotEncoder (Scikit-learn)? Question: I’m learning different methods to convert categorical variables to numeric for machine-learning classifiers. I came across the pd.get_dummies method and sklearn.preprocessing.OneHotEncoder() and I wanted to see how they differed in terms of performance and usage. I found a tutorial on how to …

Total answers: 5

Pandas: Get Dummies

Pandas: Get Dummies Question: I have the following dataframe: amount catcode cid cycle date di feccandid type 0 1000 E1600 N00029285 2014 2014-05-15 D H8TX22107 24K 1 5000 G4600 N00026722 2014 2013-10-22 D H4TX28046 24K 2 4 C2100 N00030676 2014 2014-03-26 D H0MO07113 24Z I want to make dummy variables for the values in column …

Total answers: 5