I have data in different columns but I don\'t know how to extract it to save it in another variable.
index a b c 1 2 3 4 2 3 4 5
You can use pandas.DataFrame.filter method to either filter or reorder columns like this:
pandas.DataFrame.filter
df1 = df.filter(['a', 'b'])
This is also very useful when you are chaining methods.