For a Web-Scraping application, I'm comparing some data from my database with some data, which I scraped from a Website. I save the data in two different columns of my Dataframe.
Comparing works well! I get the amount of Rows which have the same value in the 2 columns. But as my project keeps growing, I also want to know on which index the comparison returns true. How can I do this?
Some additional information
My Dataframe:
df_single["Database"]: Schloss Haindorf Hotelbetriebs GmbH 1. Aichfelder Druck Gesellschaft m.b.H. Rössler Elektro Korbel Elektro Schefbänker AWESOME X e.U. df_single["Scraped"]: Schloss Haindorf Hotelbetriebs GmbH 1. Aichfelder Druck Gesellschaft m.b.H. Elektro Rössler OG Elektro Schefbänker KG AWESOME X e.U. My comparison with .eq()
same_single = df_single["Database"].str.lower().eq(df_single["Scraped"].str.lower()).sum() My Output:
[IN:] print(same_single) [OUT:] 3 Wanted Output:
[IN:] print(index where comparison = true) [OUT:]Comparison was true at Index: 3,5 and 7