1
In a date frame that contains two lines with Pais = India, I was able to create a duplicity-free data frame with only one line from India A data frame with duplicate line only I need to create a data frame that contains only the two lines of the country = India How can I do that?
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???