import adata import sqlite3 conn = sqlite3.connect('big-a.db') res_df = adata.stock.info.all_code() no_exit = res_df['short_name'].map(lambda x: not x.endswith('退')) have_date = res_df['list_date'].map(lambda x: not (not x)) no_st = res_df['short_name'].map(lambda x: 'ST' not in x) no_pt = res_df['short_name'].map(lambda x: 'PT' not in x) filtered = res_df[no_exit & no_st & no_pt & res_df['list_date'].notnull()] filtered.to_sql('all_code', con=conn, if_exists='replace', index=False) print('Done')