title: Convert the categorical integer list iris.target into three binary attribute representation and store the result in variable iris_target_onehot,
body: <p>Convert the categorical integer list <code>iris.target</code> into three binary attribute representation and store the result in variable <code>iris_target_onehot</code>.</p>
  
  <p>I am getting attribute error:</p>
  
  <blockquote>
    <p>AttributeError: 'OneHotEncoder' object has no attribute 'toarray'</p>
  </blockquote>
  
  <pre><code>enc = preprocessing.OneHotEncoder()
  iris_target_onehot = enc.fit(iris.target.reshape(-1, 1))
  print(iris_target_onehot.toarray()[[0,50,100]])
  </code></pre>