In Pandas Dataframe, if a df['field1'] is a member of a field df2['field2'], then I need to overwrite the values of a third field df[field3] with a specified value.
I've tried using CASE in sqlite3:
conn=sqlite3.connect(':memory:')
sql.write_frame(equip,name='equip',con=conn)
sql.write_frame(list1,name='list1',con=conn)
list2=sql.read_frame("SELECT CASE WHEN (a.'Invoice Number' IN (SELECT b.'Sold On Invoice Number' FROM equip b) THEN a.'Type'='blah' FROM list1 as a END",conn)
I've tried endless permutations of this, as well as Python's native if-then-else functionality.
Any ideas?
Aucun commentaire:
Enregistrer un commentaire