title: Replacing all column values using Window operation?
body: <p>Hi Data frame  created like below.</p>
  
  <pre><code>df = sc.parallelize([
      (1, 3),
      (2, 3),
      (3, 2),
      (4,2),
      (1, 3)
  ]).toDF(["id",'t']) 
  </code></pre>
  
  <p>it shows like below.</p>
  
  <pre><code>+---+---+
  | id|  t|
  +---+---+
  |  1|  3|
  |  2|  3|
  |  3|  2|
  |  4|  2|
  |  1|  3|
  +---+---+
  </code></pre>
  
  <p>my main aim  is ,I want to replace repeated value in every column with how many times repeated.</p>
  
  <p>so i have tried flowing code it is not working as expected.</p>
  
  <pre><code>from pyspark.sql.functions import col
  column_list = ["id",'t']
  w = Window.partitionBy(column_list)
  dfmax=df.select(*((count(col(c)).over(w)).alias(c) for c in df.columns))
  dfmax.show()
  +---+---+
  | id|  t|
  +---+---+
  |  2|  2|
  |  2|  2|
  |  1|  1|
  |  1|  1|
  |  1|  1|
  +---+---+
  </code></pre>
  
  <p>my expected output will be</p>
  
  <pre><code>+---+---+
  | id|  t|
  +---+---+
  |  2|  3|
  |  1|  3|
  |  1|  1|
  |  1|  1|
  |  2|  3|
  +---+---+
  </code></pre>