比如删除以下DataFrame的后两列
0 1 2
0 1 0 1
1 0 0 1
2 1 0 1
3 0 0 1
4 0 0 1
我现在能想到的是
df.ix[:,~((df==1).all()|(df==0).all())]
显然,如果重复的数字是2、3、4、5....,那这么写就太麻烦了
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
df.ix[:, (df != df.ix[0]).any()]