Skip to content

Python code snippet – How to drop a column by name in pandas?

>>> df.drop(columns=['B', 'C'])
   A   D
0  0   3
1  4   7
2  8  11
See also  Python code snippet - How copy and create same conda environment?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.