How can I select columns which are not consecutive?
e.g.
index a b c
1 2 3 4
2 3 4 5
How do I select 'a', 'c' and save it in to df1?
df1 = df.log[:, 'a''c'] but it doesn't work...
How can I select columns which are not consecutive?
e.g.
index a b c
1 2 3 4
2 3 4 5
How do I select 'a', 'c' and save it in to df1?
df1 = df.log[:, 'a''c'] but it doesn't work...
First of all I believe there is a typo. Your code should be
df1 = df.loc[:, ['a', 'c]]