SHARE
TWEET

Untitled

a guest Jun 20th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. _id  parent_id  type
  2.     A    B          Subcategory_level
  3.     B    null       Main_Level
  4.     D    A          Product_Level
  5.     M    N          Product_Level
  6.     X    Y          Subcategory_Level
  7.     Z    X          Subcategory_Level
  8.     L    Z          Product_Level
  9.      
  10. _id  parent_id  type
  11.     D    A          product_level
  12.     M    N          product_level
  13.     L    X          product_level
  14.      
  15. df1=df
  16.     df1.rename(columns= {'_id':'parent_id','parent_id':'_id'},
  17.      
  18. final_df=pd.merge(df,df1,on='parent_id', how='inner')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top