How to drop columns which have same values in all rows via pandas or spark dataframe?
<p>Suppose I've data similar to following:</p>
<pre><code>  index id   name  value  value2  value3  data1  val5
    0  345  name1    1      99      23     3      66
    1   12  name2    1      99      23     2      66
    5    2  name6    1      99      23     7      66
</code></pre>
<p>How can we drop all those columns like (<code>value</code>, <code>value2</code>, <code>value3</code>) where all rows have the same values, in one command or couple of commands using <strong>python</strong>?</p>
<p>Consider we have many columns similar to <code>value</code>, <code>value2</code>, <code>value3</code>...<code>value200</code>.</p>
<p>Output:</p>
<pre><code>   index    id  name   data1
       0   345  name1    3
       1    12  name2    2
       5     2  name6    7
</code></pre>