I have two dataframes, one is called now & the other called old. Both have a string index. I am trying to find where a index value is in the now dataframe but not in the old dataframe.
I write tried the line below & it returns a series of True values
new_deals = now.index.isin(old.index)
However the now dataframe has an index value '4025542MM' which is not in the old dataframe & when I test the line below it returns False. So I'm confused why when I use the isin function it is returning True?
'4025542MM' in old.index = False
update
Its hard to copy data examples across. Below is a subset of some of the index values. The old dataframe data comes from sql and the index column is nvarchar(20) in sql server. The now dataframe data is coming from a text file.
I have tried using strip() but it makes no difference. I don't believe there is any extra white space as far as I can tell. In both dataframes the column is of type object.
3000093MM
3000161MM
3000166MM
3000273MM
3000285MM
3000291MM
3000354MM
3000458MM
3000547MM
3000773MM
3000938MM
3001080MM
question from:
https://stackoverflow.com/questions/66060595/finding-where-index-from-one-dataframe-is-not-in-another-dataframe 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…