pandas loc on str lower for column comparison

Piet van Oostrum piet-l at vanoostrum.org
Sat Aug 31 15:19:19 EDT 2019


Sayth Renshaw <flebber.crue at gmail.com> writes:

> But on both occasions I receive this error.
>
> # KeyError: 'the label [Current Team] is not in the [index]'
>
> if I test df1 before trying to create the new column it works just fine.
>
What do you mean by testing df1?

And could it be that 'Current Team' is spelled differently in the assignment than in the construction of df1? For example a difference in spaces, like a triling space or a breaking vs. non-breaking space? Please check that both are exactly the same.

-- 
Piet van Oostrum <piet-l at vanoostrum.org>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]



More information about the Python-list mailing list