Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
loc error
#1
Hi ,

While trying to restrict data set to UK cases only . I have applied the following code .
*************************************************************************
df1 = df1.loc[df1['Country'] == 'United Kingdom']
*************************************************************************
error :
AttributeError: 'list' object has no attribute 'loc'

Can anyone please suggest, why is this happening ?
Reply


Messages In This Thread
loc error - by Analyst - Oct-18-2017, 07:18 AM
RE: loc error - by snippsat - Oct-18-2017, 11:15 AM

Forum Jump:

User Panel Messages

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