I wrote this code to find the only respondents to a question in Survey.
table_name = 'Samples'
QUERY = """
select x.*
from Samples as x
where x.Respondent IN
(
select Respondent
from Samples
group by Respondent
having count(distinct Samples) = 1
)
"""
df = pd.read_sql_query(QUERY,conn)
df[Samples].value_counts()
How may I include the python Code
df = pd.read_sql_query(QUERY,conn)
df[Samples].value_counts()
in the SQL code to count the respondent and to get the same result?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…