Python Forum
Pandas DataFrame and unmatched column
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pandas DataFrame and unmatched column
#1
df1 has 3 columns 'A','B','C' df2 has 3 columns 'A','B','C'

below is the option tried for find common records between two columns('A','B') in two dataframes and finding the unmatched records on column('C').

Please suggest , if there is a better way.

matched_on_AB_not_C = pd.merge(df1,df2,on=['A','B'], how='inner')
duration_diff = (matched_on_AB_not_C['C_y'].ne(matched_on_AB_not_C['C_x']))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  concat 3 columns of dataframe to one column flash77 2 753 Oct-03-2023, 09:29 PM
Last Post: flash77
  HTML Decoder pandas dataframe column mbrown009 3 932 Sep-29-2023, 05:56 PM
Last Post: deanhystad
  attempt to split values from within a dataframe column mbrown009 8 2,191 Apr-10-2023, 02:06 AM
Last Post: mbrown009
  Use pandas to obtain cartesian product between a dataframe of int and equations? haihal 0 1,080 Jan-06-2023, 10:53 PM
Last Post: haihal
  pandas column percentile nuncio 7 2,357 Aug-10-2022, 04:41 AM
Last Post: nuncio
  Pandas Dataframe Filtering based on rows mvdlm 0 1,381 Apr-02-2022, 06:39 PM
Last Post: mvdlm
  Pandas dataframe: calculate metrics by year mcva 1 2,251 Mar-02-2022, 08:22 AM
Last Post: mcva
  Pandas dataframe comparing anto5 0 1,229 Jan-30-2022, 10:21 AM
Last Post: anto5
  PANDAS: DataFrame | Replace and others questions moduki1 2 1,745 Jan-10-2022, 07:19 PM
Last Post: moduki1
  PANDAS: DataFrame | Saving the wrong value moduki1 0 1,515 Jan-10-2022, 04:42 PM
Last Post: moduki1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020