I have 2 dataframe, DataFrame1: LocationListExport - Columns: ['CountryCode', 'Country Name'] Dataframe2: Location - Columns: ['Code', 'Name']
I want to find the LocationListExport['CountryCode'] which is not present in Location['Code']
My Function:
def checkDimensionListItems(dataDL, dDLdimensionCode, knoxDimensionWithCode):
newDimensionItemAdded = dataDL[~dataDL[dDLdimensionCode].isin(knoxDimensionWithCode)][dDLdimensionCode].unique()
return newDimensionItemAdded
Calling Function:
checkDimensionListItems(LocationListExport, 'CountryCode', 'Location.Code')
Error Occurs: AttributeError: TypeError: only list-like objects are allowed to be passed to isin(), you passed a [str]
Below script works fine without function, But I want update for many dataframe.
LocationListExport[~LocationListExport.CountryCode.isin(Location.Code)].CountryCode.unique()
Can we do this using user defined function.