Python Pandas Equivalent to Excel Countif -
i have tried different solutions similar questions made, didn't expected result, far.
i have 2 dataframes, df1 , df2, both of them contain column named 'fb rq id'.
there far more lines in df2 in df1, , want check values df2['fb rq id'] in df1['fb rq id'] , how many times appears there, creating column on df2 number of times value on line in df1.
if know how create column binary information wether df2.['fb rq id'] in df1['fb rq id'] , helps.
thank you!!
how this?
df2['count_from_df1'] = [list(df1['fb rq id']).count(id) if id in df1['fb rq id'] else 0 id in df2['fb rq id']]
Comments
Post a Comment