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)]
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be6116-317b5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be6116-317b5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?