In a data frame that contains two lines with Country = India, I was able to create a data frame without duplicity with only one line in India A data frame only with the duplicate line I need to create a data frame that contains only the two lines of Country = India How can I do this?
import pandas as pd
import numpy as np
data = {
'País': ['Bélgica', 'Índia', 'Brasil','Índia'],
'Capital': ['Bruxelas', 'Nova Delhi', 'Brasília', 'Nova Delhi'],
'População': [123465, 456789, 987654, 456789]
}
# gera DF excluindo as linhas duplicadas
drop_df = df.drop_duplicates()
# gera data frame somente com as duplicidades
dfdrop = df[df.duplicated() == True]
How to generate a DF only with the two lines of the Country India ???