Consider a pyspark dataframe consisting of 'null' elements and numeric elements. In general, the numeric elements have different values. How is it possible to replace all the numeric values of the dataframe by a constant numeric value (for example by the value 1)? Thanks in advance! Example for the pyspark dataframe:$$\begin{array}{c|lcr}& \text{c1} & \text{c2} & \text{c3} \\\hline1 & 0.04 & 1 & 1.35 \\2 & -1 & null & -1.2 \\3 & null & 1.2 & null\end{array}$$The result should be:$$\begin{array}{c|lcr}& \text{c1} & \text{c2} & \text{c3} \\\hline1 & 1 & 1 & 1 \\2 & 1 & null & 1 \\3 & null & 1 & null\end{array}$$
Replace all numeric values in a pyspark dataframe by a constant value
python;apache spark