title: Finding Ratio of Every Column Pyspark
body: <p>Let's say I have the following DF.</p>
  <pre><code>df = sqlContext.createDataFrame(sc.parallelize(
      [('a',0, 1,1), ('b',1, 3,4), ('c',2, 5,7)]), ('acc_no','col_1', 'col_2','sum'))
  
  +------+-----+-----+---+
  |acc_no|col_1|col_2|sum|
  +------+-----+-----+---+
  |     a|    0|    1|  1|
  |     b|    1|    3|  4|
  |     c|    2|    5|  7|
  +------+-----+-----+---+
  </code></pre>
  <p>I want to find the create a new column for percentage of <strong>col_1</strong> and <strong>col_2</strong> over the <strong>sum</strong> column as below.</p>
  <pre><code>+------+-----+-----+---+---------+---------+
  |acc_no|col_1|col_2|sum|perc_col1|perc_col2|
  +------+-----+-----+---+---------+---------+
  |     a|    0|    1|  1|        0|      100|
  |     b|    1|    3|  4|       25|       75|
  |     c|    2|    5|  7|       29|       71|
  +------+-----+-----+---+---------+---------+
  </code></pre>
  <p>I know I can use the following code to add the percentage column for each col_1 and col_2</p>
  <pre><code>df.withColumn('perc_col1',col('col_1')/col('sum')*100).withColumn('perc_col2',col('col_2')/col('sum')*100).show()
  </code></pre>
  <p>But how can I do it if I have <strong>hundreds</strong> of columns and I'd like to avoid writing hundreds lines of code?</p>