select columns pandas and drop code example
Example 1: drop columns pandas
df.drop(columns=['B', 'C'])
Example 2: select columns pandas
df1 = df.iloc[:,0:2] # Remember that Python does not slice inclusive of the ending index.
df.drop(columns=['B', 'C'])
df1 = df.iloc[:,0:2] # Remember that Python does not slice inclusive of the ending index.