import pandas as pd
# Assuming you have a DataFrame called 'df'
# and you want to select columns 'column1' and 'column2'
# Method 1: Using the bracket operator []
selected_columns = df[['column1', 'column2']]
# Method 2: Using the loc accessor
selected_columns = df.loc[:, ['column1', 'column2']]
# Method 3: Using the iloc accessor
# Here, '0' is the index of the first column you want to select
# '2' is the index of the column after the last column you want to select (exclusive)
selected_columns = df.iloc[:, 0:2]