title: How to convert a column with multiple values into binary variables in Pandas
body: <p>I have a dataframe with 1.5M rows and one column. It looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/g60U8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g60U8.png" alt="enter image description here"></a></p>
  
  <p>I want to split the column 'jobroles' into multiple columns with 1s and 0s (hot-coding). Following is what I have tried so far:</p>
  
  <pre><code>df_bits = df['jobroles'].str.join(sep=',').str.get_dummies(sep=',')
  </code></pre>
  
  <p>But it is not just splitting on "," but each and every digit. For example, "2424638" gets split into "2", "3", "4", "6" and "8". Below the result I am getting.</p>
  
  <p><a href="https://i.stack.imgur.com/U35Ge.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U35Ge.png" alt="enter image description here"></a></p>