我不确定什么是错误,我想在SQL查询中使用499
,Country
在哪里说Test
,以便放置Test
的所有其他内容,但它给出了所有结果词499
,我不明白为什么,在结果中我看到SELECT SQL_NO_CACHE id, drzavljanstvo,
( CASE WHEN drzavljanstvo=(
SELECT id_drzavljanstvo from drzavljanstvo WHERE id_drzavljanstvo=499)
THEN 'Country' ELSE 'Test' END) location
FROM bol_rac;
?有人能帮助我吗?
#first convert `subject_id` to int
df_a['subject_id'] = df_a['subject_id'].astype(int)
m1 = (df_a['subject_id'] == 2) & (df_a['first_name'] == 'Amy')
m2 = (df_a['subject_id'] > 0) & (df_a['first_name'] == 'Alice')
df_a['outcome'] = np.select([m1, m2], [2,1], default=0)
print (df_a)
subject_id first_name last_name outcome
0 1 Alex Anderson 0
1 2 Amy Ackerman 2
2 3 Allen Ali 0
3 4 Alice Aoni 1
4 5 Ayoung Atiches 0
结果如下所示