So I had a dataframe that had 5000 rows and 40 columns. After some analysis I had to do it was reduced to 3000 rows and 8 columns. Now my problems is that I want to extract the entire row from the old dataframe but I make a mistake not following through with the index and I cannot use it to extract them. Is there another way to do it?
so far I have tried this. Is there anything I can do to this function to extract the whole row?
a=df_unique[df_unique['CUSTOMERID'].isin(df['CUSTOMERID'])]
Sounds like you just need to do an inner join:
import pandas as pd
result_df = pd.merge(new_df, old_df, on='CUSTOMERID', how='inner')
Please let me know if this solves your problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.