title: Getting Dummies from a dataset using javascript
body: <p>I have downloaded the a Heart Disease database. Certain values however, such as <code>"restecg"</code> and <code>"cp"</code> have more than one possible value. I would like to separate those values into their own columns with values of 0 or 1 and then perform a logistic regression on them. Normally, in python, I would just do this</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  from sklearn import preprocessing
  from sklearn.linear_model import LogisticRegression
  from sklearn.cross_validation import train_test_split
  
  data = pd.read_csv('bank.csv', header = 0)
  data = data.dropna()
  dataRefactored = pd.get_dummies(data, columns=['...']) #Columns I want to get dummies for
  X_train, X_test, Y_train, Y_test = train_test_split(X, Y)
  classifier = LogisticRegression()
  classifier.fit(X_train, Y_train)
  </code></pre>
  
  <p>If the input was:</p>
  
  <pre><code>Slope
    1
    3
    2
    1
  </code></pre>
  
  <p>The output would be:</p>
  
  <pre><code>Slope_1 Slope_2 Slope_3
     1      0       0
     0      0       1
     0      1       0
     1      0       0
  </code></pre>
  
  <p>How would I replicate this in JS?</p>