from spacy.en import English
nlp = English()
sent = 'I shot an elephant'
doc = nlp(sent)
sub_toks = [tok for tok in doc if tok.dep_ == 'nsubj']
print(sub_toks)
How to identify the subject of a sentence?