This looks like my DataFrame :
StateAb GivenNm Surname PartyNm PartyAb ElectedOrder
35 WA Joe BULLOCK Australian Labor Party ALP 2
36 WA Michaelia CASH Liberal LP 3
37 WA Linda REYNOLDS Liberal LP 4
38 WA Wayne DROPULICH Australian Sports Party SPRT 5
39 WA Scott LUDLAM The Greens (WA) GRN 6
and I want to list a list of senators whose last name exceeds 9 characters.
So I think the code should be like this:
df[len(df.Surname) > 9]
but this causes a KeyError , where did I go wrong?
source share