{"id":5609,"date":"2023-10-27T09:30:43","date_gmt":"2023-10-27T04:00:43","guid":{"rendered":"https:\/\/python-programs.com\/?p=5609"},"modified":"2023-11-10T12:02:27","modified_gmt":"2023-11-10T06:32:27","slug":"python-pandas-drop-columns-in-dataframe-by-label-names-or-by-index-positions","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-pandas-drop-columns-in-dataframe-by-label-names-or-by-index-positions\/","title":{"rendered":"Python Pandas : Drop columns in DataFrame by label Names or by Index Positions"},"content":{"rendered":"

How to drop columns in DataFrame by label Names or by Index Positions in Python ?<\/h2>\n

In this article, we are going to demonstrate how to drop columns in a dataframe by their labels or index. So, let’s start exploring the topic in detail.<\/p>\n

In dataframe there is a function drop()<\/code> which can be used to drop columns.<\/p>\n

Syntax – DataFrame.drop<\/em><\/p>\n

(labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors='raise')<\/pre>\n

Where,<\/p>\n