Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.loc with Booleans
#1
Can someone explain the mechanism of this output?

df = pd.DataFrame([[1, 2], [4, 5], [7, 8]],
     index=['cobra', 'viper', 'sidewinder'],
     columns=['max_speed', 'shield'])


>>> df.loc[[False,False,True]]
            max_speed  shield
sidewinder          7       8
Reply


Messages In This Thread
.loc with Booleans - by Mark17 - Aug-27-2020, 02:14 PM
RE: .loc with Booleans - by snippsat - Aug-27-2020, 03:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I find a string in sequence (with Booleans)? go127a 3 2,281 Apr-23-2019, 01:58 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020