I have two different csv files:
- All current active users
- All users who who are registered in our app (both active and non-active users)
I need to identify which active users are registered in our app. Any suggestions?
Can't decide between using for loops or pandas. I would love to hear some suggestions before digging in.
P.S: Both csv files have the same columns: ID number, name, last name, email, phone.
CodePudding user response:
According to your question the active and non active users together give you your list of registered users. In that case all your active users will be in the registered users list. So the answer would be all the active users are registered.
In any case if you want to find the common rows in two dataframes with respect to a particular column you can use the merge function in pandas after you convert your CSV files into 2 data frames. [https://www.geeksforgeeks.org/intersection-of-two-dataframe-in-pandas-python/amp/] this link should help with what you want.
CodePudding user response:
Try active_users.merge(registered_users, how="left", on="ID")
, but you should add an additional column to registered_users data frame in order to identify matched rows.