How to retrieve a specific no of columns?
To retrieve a specific number of columns below is the code:
(Name_of_dataframe.columns)[:number_of_columns]
e.g. if we want to retrieve first 5 columns in a dataframe named "value", it would be
(value.columns)[:5]
The index can be manipulated to retrieve the specific number of columns
Comments
0 comments
Article is closed for comments.