我在pyspark中有一个数据框。
df.columns
['id', 'name', 'date', 'city']
df1 = df [[i for list in list(df.columns)if if!='date']]
当我做df1.columns时,我得到了
['id', 'name', 'city']
test_df = df [[i for list in list(df.columns)if i!='date''city']]
当我做test_df.columns时,我正在
['id, 'name', 'date', 'city']
而不是
['id', 'name']
为什么会这样?什么是正确的使用方法!=多列。
我不想使用df.select方法。
答案 0 :(得分:0)
public static void main(String[] args) {
Stack stack1 = new Stack();
//filling the stack with numbers from 0 to 4
for(int i = 0; i < Constants.MAX_ELMNTS; i++){
stack1.push(new Integer(i));
System.out.println(i);
}
Stack reverse = new Stack();
while(stack1.getNbElements() > 0){
reverse.push(stack1.pop());
}