Python 选择除sqllite3之外的行

Python 选择除sqllite3之外的行,python,sqlite,Python,Sqlite,我有一个带有数据框的数据库,其中包含以下列:姓名、奖项、获奖者(1表示获奖,0表示未获奖)以及与此问题无关的其他内容 我想用python中的sqlite 3制作一个数据框,其中包含被选为女演员的人的名字(所有有女演员名字的奖项都算),但从未获奖 以下是数据帧的前五行: Unnamed: 0 CeremonyNumber CeremonyYear CeremonyMonth CeremonyDay FilmYear Award Winner Name FilmDet

我有一个带有数据框的数据库,其中包含以下列:姓名、奖项、获奖者(1表示获奖,0表示未获奖)以及与此问题无关的其他内容

我想用python中的
sqlite 3
制作一个数据框,其中包含被选为女演员的人的名字(所有有女演员名字的奖项都算),但从未获奖

以下是数据帧的前五行:

Unnamed: 0  CeremonyNumber  CeremonyYear    CeremonyMonth   CeremonyDay FilmYear    Award   Winner  Name    FilmDetails
0   0   1   1929    5   16  1927    Actor   1   Emil Jannings   The Last Command
1   1   1   1929    5   16  1927    Actor   0   Richard Barthelmess The Noose
2   2   1   1929    5   16  1927    Actress 1   Janet Gaynor    7th Heaven
3   3   1   1929    5   16  1927    Actress 0   Louise Dresser  A Ship Comes In
4   4   1   1929    5   16  1927    Actress 0   Gloria Swanson  Sadie Thompson
我尝试了这个查询,但结果不正确

query = '''
select Name
from oscars
where Award like "Actress%"
except select Name
        from oscars
        where Award like "Actress%" and Winner == 1
'''
此查询的结果应该是如下所示的数据帧:

    Name
0   Abigail Breslin
1   Adriana Barraza
2   Agnes Moorehead
3   Alfre Woodard
4   Ali MacGraw

为了选择所有被选中但从未获奖的女演员,您应该使用and而不是EXCEPT。类似这样的方法应该会奏效:
从奥斯卡金像奖中选择名字,如“女演员%”和获奖者=0


有关更多信息,请参阅位于的sqlite文档。

请提供一些示例数据和所需的输出。(请参阅如何添加一些。)这看起来更像是一个SQL问题,而不是python问题,但是在不知道数据的情况下很难帮助你。我用更多数据编辑了这个问题。你也可以发布你得到的结果吗?问题中的最后一个数据框是结果的前5行。查询总共给出301行,但是我应该得到一个包含448行的数据帧