Skip to content
Advertisement

how to insert pandas dataframe into IN operator of SQL

I have pandas dataframe with unique number of user:

I want to pass this column to sql query where I use IN operator:

I have tried doing this

which would retrun whith this '1qw3,2wed,3das,4frr,533ew,612w'

and then something like WHERE users in STRING_SPLIT(data_frame, ',') but this one is obviousely doesnt work…

Advertisement

Answer

You can convert the list into a tuple, this will give you the correct format

output sql variable:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement