Code Storm
Published in

Code Storm

Pandas drop columns and rows — learn python

In this post, I will show you how to drop columns and rows using pandas.

Photo by Arnold Francisca on Unsplash

Steps

  • Create a DataFrame
  • import pandas and numpy
import pandas as pd
import numpy as np
df = pd.DataFrame(np.arange(9).reshape(3, 3), columns=['x', 'y', 'z'])

Drop Columns

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store