Please consider this df:
df = pd.DataFrame({'a':[1,2], 'b':[1,2], 'c':[1,2], 'd':[1,2], 'e':[1,2], 'f':[1,2], 'g':[1,2], 'h':[1,2]})
a b c d e f g h
0 1 1 1 1 1 1 1 1
1 2 2 2 2 2 2 2 2
How can I select the 1st, 4th, and 5th-7th columns?
What I tried:
df.iloc[:, [0, 3, np.arange(5,8)]]
ValueError: setting an array element with a sequence.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…