Quiero realizar en python el siguiente proceso que en RStudio es muy sencillo con la función setdiff()
library(tidyverse)
# 1| data.frame sobre población
pop <- structure(list(country = c("Afghanistan", "Angola", "Albania",
"Andorra", "United Arab Emirates",
'Canada', 'United States'),
`2021` = c("40.8M", "35M", "2.87M", "77.5k", "10.1M", "30.2M", "50.6M"),
`2022` = c("41.7M", "36.1M", "2.86M", "77.6k", "10.2M", "30.6M","51.7M")),
row.names = c(NA, -7L), class = c("tbl_df", "tbl", "data.frame"))
# data.frame sobre ingresos
inc <- structure(list(country = c("Afghanistan", "Angola", "Albania",
"Andorra", "United Arab Emirates"),
`2021` = c("1990", "5980", "14.7k", "56.5k", "65.2k"),
`2022` = c("2040", "6000", "15.1k", "56.9k", "66.3k")),
row.names = c(NA, -5L), class = c("tbl_df", "tbl", "data.frame"))
setdiff(pop$country, inc$country)
El resultado de la función setdiff()
, arroja: "Canada" "United States"
¿Cómo puedo realizar este mismo proceso pero en python?