title: spark converting CSV to libsvm format
body: <p>I have a CSV file with state, age, gender, salary etc as independent variables.</p>
  
  <p>Dependent variable is churn.</p>
  
  <p>In spark, we need to convert the dataframe to libsvm format. can you one tell me how to do it.</p>
  
  <p>libsvm format is : 0 128:51</p>
  
  <p>AS A FEATURE VALUE HERE MEANS THAT THERE IS VALUE 51 IN COLUMN 128.</p>