Back
When we create list using the below code, we get the list of all the columns but I want to get the list of only 3 to 5 specific columns.
col_list= list(df)
Here, for getting the list of only 3 to 5 specific columns you can use slicing of list:
df[df.columns[2:5]]
If you wish to learn more about how to use python for data science, then go through this data science python course by Intellipaat for more insights.
31k questions
32.8k answers
501 comments
693 users