Deletion is one of the primary operations when it comes to data analysis. Very often we see that a particular attribute in the data frame is not at all useful for us while working on a specific analysis, rather having it may lead to problems and unnecessary change in the prediction. For example, if we want to analyze the students’ BMI of a particular school, then there is no need to have the religion column/attribute for the students, so we prefer to delete the column. Let us now see the syntax of deleting a column from a dataframe.
Let us now see few examples:
Note the column ‘Age” has been droped.
Note that the unnecessary column, ‘Religion’ has been deleted successfully.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course