title: Pyspark Getting error while replacing null with 0
body: <p>I am working on PySpark Python and I have mentioned the code and getting some issue, I am wondering if someone knows about the following issue?</p>
  <p>My sample dataset</p>
  <pre><code>data = [('12er',None), ('4xcf',None), ('6hjk',None), \
        ('45fh',2000),('56gh',2000),('hj45',None)]
  
  
  columns= [&quot;Id&quot;,&quot;Amount&quot;]
  pivotDF= spark.createDataFrame(data = data, schema = columns)
  pivotDF.show(truncate=False)
  </code></pre>
  <p>Snippet of original dataset
  <a href="https://i.stack.imgur.com/nboFS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nboFS.png" alt="enter image description here" /></a>
  I am using fill to replace null with zero</p>
  <pre><code>pivotDF.na.fill(0).show(n=2)
  </code></pre>
  <p>While I am able to do this in sample dataset but in my pspark dataframe
  I am getting this error</p>
  <pre><code>Fail to execute line 1: pivotDF.na.fill(0).show(n=2)
  Traceback (most recent call last):
    File &quot;/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/utils.py&quot;, line 63, in deco
      return f(*a, **kw)
    File &quot;/usr/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py&quot;, line 328, in get_return_value
      format(target_id, &quot;.&quot;, name), value)
  py4j.protocol.Py4JJavaError: An error occurred while calling o244.fill.
  : org.apache.spark.sql.AnalysisException: Reference 'Cancel' is ambiguous, could be: Cancel, Cancel.;
      at org.apache.spark.sql.catalyst.expressions.package$AttributeSeq.resolve(package.scala:259)
      at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.resolveQuoted(LogicalPlan.scala:126)
      at org.apache.spark.sql.Dataset.resolve(Dataset.scala:222)
      at org.apache.spark.sql.Dataset.col(Dataset.scala:1269)
      at org.apache.spark.sql.DataFrameNaFunctions.org$apache$spark$sql$DataFrameNaFunctions$$fillCol(DataFrameNaFunctions.scala:443)
      at org.apache.spark.sql.DataFrameNaFunctions$$anonfun$7.apply(DataFrameNaFunctions.scala:502)
      at org.apache.spark.sql.DataFrameNaFunctions$$anonfun$7.apply(DataFrameNaFunctions.scala:492)
      at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
      at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
      at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
      at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
      at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
      at scala.collection.mutable.ArrayOps$ofRef.map(ArrayOps.scala:186)
      at org.apache.spark.sql.DataFrameNaFunctions.fillValue(DataFrameNaFunctions.scala:492)
      at org.apache.spark.sql.DataFrameNaFunctions.fill(DataFrameNaFunctions.scala:179)
      at org.apache.spark.sql.DataFrameNaFunctions.fill(DataFrameNaFunctions.scala:163)
      at org.apache.spark.sql.DataFrameNaFunctions.fill(DataFrameNaFunctions.scala:140)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
      at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
      at py4j.Gateway.invoke(Gateway.java:282)
      at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
      at py4j.commands.CallCommand.execute(CallCommand.java:79)
      at py4j.GatewayConnection.run(GatewayConnection.java:238)
      at java.lang.Thread.run(Thread.java:748)
  
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;/tmp/zeppelin_pyspark-3253703896.py&quot;, line 473, in &lt;module&gt;
      exec(code, _zcUserQueryNameSpace)
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/dataframe.py&quot;, line 2241, in fill
      return self.df.fillna(value=value, subset=subset)
    File &quot;/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/dataframe.py&quot;, line 1665, in fillna
      return DataFrame(self._jdf.na().fill(value), self.sql_ctx)
    File &quot;/usr/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py&quot;, line 1257, in __call__
      answer, self.gateway_client, self.target_id, self.name)
    File &quot;/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/utils.py&quot;, line 69, in deco
      raise AnalysisException(s.split(': ', 1)[1], stackTrace)
  pyspark.sql.utils.AnalysisException: &quot;Reference 'Cancel' is ambiguous, could be: Cancel, Cancel.;&quot;
  
  </code></pre>
  <p>My schema
  <a href="https://i.stack.imgur.com/ddeSe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ddeSe.png" alt="enter image description here" /></a></p>