df.drop

Do you want to know the details about “df.drop”. If yes, you’re in the correct tutorial.

df.drop

df = df.drop(['B', 'C'], axis=1)
df.drop(columns=['Unnamed: 0'])
df = df.drop(df.columns[[0, 1, 3]], axis=1)  # df.columns is zero-based pd.Index 
df.drop(df.index[2])
DataFrame.drop(self, labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors="raise")[source]
# pandas drop a column with drop function
gapminder_ocean.drop(['pop'], axis=1)

Final Thoughts

I hope this tutorial helps you to know about “df.drop”. If you have any questions regarding this tutorial please let us know via the comment section. Share this article with your friends and family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment