title: Sum in Spark for a Column Python
body: <p>So I have a dataset and what I am doing is taking a column out of the dataset, than mapping it to a key value pair. The problem is I can't sum my value:</p>
  
  <pre><code>position = 1
  myData = dataSplit.map(lambda arr: (arr[position]))
  print myData.take(10)
  myData2 = myData.map(lambda line: line.split(',')).map(lambda fields: (“Column", fields[0])).groupByKey().map(lambda (Column, values): (Column, sum(float(values))))
  print myData2.take(10)
  </code></pre>
  
  <p>This prints out the following:</p>
  
  <pre><code>[u'18964', u'18951', u'18950', u'18949', u'18960', u'18958', u'18956', u'19056', u'18948', u'18969’]
  TypeError: float() argument must be a string or a number
  </code></pre>
  
  <p>So When I changed it to:</p>
  
  <pre><code>myData2 = myData.map(lambda line: line.split(',')).map(lambda fields: (“Column", fields[0])).groupByKey().map(lambda (Column, values): (values))
  </code></pre>
  
  <p>I see the following:</p>
  
  <pre><code>[&lt;pyspark.resultiterable.ResultIterable object at 0x7fab6c43f1d0&gt;]
  </code></pre>
  
  <p>If I do just:</p>
  
  <pre><code>myData2 = myData.map(lambda line: line.split(',')).map(lambda fields: (“Column", fields[0]))
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>[('Column', u'18964'), ('Column', u'18951'), ('Column', u'18950'), ('Column', u'18949'), ('Column', u'18960'), ('Column', u'18958'), ('Column', u'18956'), ('Column', u'19056'), ('Column', u'18948'), ('Column', u'18969’)]
  </code></pre>
  
  <p>Any Suggestions?</p>