Say I have the following dataframe:
import pandas as pd
series = [('Stranger Things', 3, 'Millie'),
('Game of Thrones', 8, 'Emilia'),
('La Casa De Papel', 4, 'Sergio'),
('Westworld', 3, 'Evan Rachel'),
('Stranger Things', 3, 'Todd'),
('La Casa De Papel', 4, 'Sergio')]
# Create a DataFrame object
df = pd.DataFrame(series, columns=['Name', 'Seasons', 'Actor'])
I am looking for a way to create a new dataframe, or even a list, that tells me the non-unique combinations of values between 'Name' and 'Actor'.
In this example, I would like to get as a result:
Stranger Things, 3, Millie
Stranger Things, 3, Todd
I have tried the sort(), unique(), and distinct() methods without success. Unique always seems to drop the column that I am not querying on (in this case, season).
Any help is appreciated!