pandas loc on str lower for column comparison

Piet van Oostrum piet-l at vanoostrum.org
Thu Aug 29 10:49:18 EDT 2019


Piet van Oostrum <piet-l at vanoostrum.org> writes:

> So the correct way to do this is to make df1 a copy rather than a view.
>
> df1 = df.loc[:, ('UID','Name','New Leader','Current Team', 'New Team')]

Or maybe even make an explicit copy:

df1 = df[['UID','Name','New Leader','Current Team', 'New Team']].copy()
-- 
Piet van Oostrum <piet-l at vanoostrum.org>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]



More information about the Python-list mailing list