October 2019
Beginner to intermediate
674 pages
16h 43m
English
If you are familiar with lists in Python, the pop() method will ring a bell. The pop() method in series and DataFrames behaves exactly the same as it does with lists. It helps remove entire columns from DataFrames or specific rows from series. Upon being called, the pop() method returns the popped out entity (row or column).
The following snippet demonstrates the use of pop() with a series. Let's pop the item with row index 2 from the "Wins" column:
In: sample_df["Wins"].pop(2)Out: 26
Now, let's print the Wins series:

It can be seen that index 2 is no longer present in the series. The same method ...
Read now
Unlock full access