Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 23320

Ben Cook: Dropping columns and rows in Pandas

$
0
0
df.drop() The easiest way to drop rows and columns from a Pandas DataFrame is with the .drop() method, which accepts one or more labels passed in as index=<rows to drop> and/or columns=<cols to drop>: import pandas as pd df = pd.read_csv("https://jbencook.com/data/dummy-sales.csv").head() df # Expected result # date region revenue #...

Viewing all articles
Browse latest Browse all 23320

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>