How does pandas query the data of Table B according to a column of values that appear in Table A?

how to query data in B dataframe according to the ID, of A dataframe in pandas, An and B tables have the same ID column. Similar to SQL"s column-level subquery: select * from t_class where c_id in (select c_class_id from t_student) , An and B have an one-to-many relationship.


has been resolved, just use merge.


merge is a troublesome method, usually using isin.

dfa.loc[dfa.ID.isin(dfb.ID)]
Menu