Wednesday, June 17, 2020

How to delete rows and columns using Pandas


To Delete rows and columns from the data frames, we use drop method in pandas package. 

1. Name of the columns are used and specify the axis=1 to delete single or multiple columns 

2. The list of index labels can be passed to the drop method to delete the rows.

Example:

Original data frame:



Data frame after dropping columns:



Data frame after dropping rows:



















































Element wise operation on LIST vs ARRAY

The use of arrays over lists: You can write  vectorised  code on numpy arrays, not on lists, which is  convenient to read and write, and con...