title: Splitting a column in pyspark
body: <p>I am trying to split a dataframe in pyspark
  This is the data i have </p>
  
  <pre><code>df = sc.parallelize([[1, 'Foo|10'], [2, 'Bar|11'], [3,'Car|12']]).toDF(['Key', 'Value'])
  df = df.withColumn('Splitted', split(df['Value'], '|')[0])
  </code></pre>
  
  <p>I got</p>
  
  <pre><code>+-----+---------+-----+
  |Key|Value|Splitted   |
  +-----+---------+-----+
  |    1|   Food|10|   F|
  |    2|   Bar|11 |   B|
  |    3|   Caring 12| C|
  +-----+---------+-----+
  </code></pre>
  
  <p>But i want</p>
  
  <pre><code>+-----+---------+-----+
  |Key  | Value|Splitted|
  +-----+---------+-----+
  |    1|   10|  Food   |
  |    2|   11|  Bar    |
  |    3|   12|Caring   |
  +-----+---------+-----+
  </code></pre>
  
  <p>Can any one please point me to what i am doing wrong? </p>
  
  <pre><code>What if i have a unique situation like this?
  df = sc.parallelize([[1, 'Foo|10|we'], [2, 'Bar|11|we'], [3,'Car|12|we']]).toDF(['Key', 'Value'])
  
  +---+---------+
  |Key|    Value|
  +---+---------+
  |  1|Foo|10|we|
  |  2|Bar|11|we|
  |  3|Car|12|we|
  +---+---------+
  </code></pre>