dummy-data

Create dummies from column with multiple values in pandas

Create dummies from column with multiple values in pandas Question: I am looking for for a pythonic way to handle the following problem. The pandas.get_dummies() method is great to create dummies from a categorical column of a dataframe. For example, if the column has values in [‘A’, ‘B’], get_dummies() creates 2 dummy variables and assigns …

Total answers: 4

how do you make a For loop when you don't need index in python?

how do you make a For loop when you don't need index in python? Question: If I need a for loop in Python: for i in range(1,42): print "spam" but don’t use the i for anything, pylint complains about the unused variable. How should I handle this? I know you can do this: for dummy_index …

Total answers: 5