I have been using the following type of query + pandas code for different types of projects, and I am trying to find ways to do as much as possible directly in SQL instead:
import mysql.connector
list = [10,15]
sql = "select value, employee_id from employee_table"
df = pd.read_sql(sql,conn)
df_new = df.employee_id.isin(list)
So the above code would select only the salary for the employee_id of 10 and 15. In SQL, it would look like this:
select value, employee_id
from employee_table
where employee_id in (10,15)
My question is how can I do the above query in python with a python list? I am using Mysql if it is of importance.