October 2019
Beginner to intermediate
674 pages
16h 43m
English
The drop() method is another useful method that removes entire rows or columns from a DataFrame or a series. Indices can be dropped along any axis – row indices can be dropped along axis 0 and column indices can be dropped along axis 1.
Let's drop indices 0 and 2 from the Wins series. The indices to be removed can be defined through a list. The default setting for the axis is 0, and hence no change is needed in this case:
sample_df["Wins"].drop([0, 2])
The following is the output:

As we can see, the result does not have 0 and 2 and indexes. The following snippet shows the use of the drop method ...
Read now
Unlock full access