How to use drop() Method to select all columns, except one given column In Python Pandas
Dataframe supports drop() method to drop a particular column. It accepts two arguments, column/row name and axis
Example: Select all columns, except one ‘student_city’ column in Pandas Dataframe.
Python3
# drop method df = data.drop( 'student_city' , axis = 1 ) # show the dataframe df |
Output:
Select all columns, except one given column in a Pandas DataFrame
DataFrame Data structure are the heart of Pandas library. DataFrames are basically two dimension Series object. They have rows and columns with rows representing the index and columns representing the content. Now, let’s see how to Select all columns, except one given column in Pandas DataFrame in Python.
Contact Us