title: KeyError: 'Passing list-likes to .loc or [] with any missing labels is no longer supported on json file
body: <pre><code>{'meta': {'code': 200, 'requestId': '5e7c703bb9a389001b7d1e8c'},
   'response': {'suggestedFilters': {'header': 'Tap to show:',
     'filters': [{'name': 'Open now', 'key': 'openNow'}]},
    'headerLocation': 'Lagos',
    'headerFullLocation': 'Lagos',
    'headerLocationGranularity': 'city',
    'totalResults': 39,
    'suggestedBounds': {'ne': {'lat': 6.655478745000045,
      'lng': 3.355524537252914},
     'sw': {'lat': 6.565478654999954, 'lng': 3.2650912627470863}},
    'groups': [{'type': 'Recommended Places',
      'name': 'recommended',
      'items': [{'reasons': {'count': 0,
         'items': [{'summary': 'This spot is popular',
           'type': 'general',
           'reasonName': 'globalInteractionReason'}]},
        'venue': {'id': '502806dce4b0f23b021f3b77',
         'name': 'KFC',
         'location': {'lat': 6.604589745106469,
          'lng': 3.3089358809010045,
          'labeledLatLngs': [{'label': 'display',
            'lat': 6.604589745106469,
            'lng': 3.3089358809010045}],
          'distance': 672,
          'cc': 'NG',
          'city': 'Egbeda',
          'state': 'Lagos',
          'country': 'Nigeria',
          'formattedAddress': ['Egbeda', 'Lagos', 'Nigeria']},
         'categories': [{'id': '4bf58dd8d48988d16e941735',
           'name': 'Fast Food Restaurant',
           'pluralName': 'Fast Food Restaurants',
           'shortName': 'Fast Food',
           'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/fastfood_',
            'suffix': '.png'},
           'primary': True}],
         'photos': {'count': 0, 'groups': []}},
        'referralId': 'e-0-502806dce4b0f23b021f3b77-0'},
  </code></pre>
  
  <p>That is a part of my file about called 'results'</p>
  
  <p>I then </p>
  
  <pre><code>def getCAT(row):
      try:
          categories_list=row['categories']
      except:
          categories_list=row['venue.categories']
  
      if len(categories_list)==0:
          return None
      else:
          return categories_list[0]['name']
  </code></pre>
  
  <p>venues=results['response']['groups'][0]['items']</p>
  
  <p>nearby_venues=pd.json_normalize(venues)</p>
  
  <p>filtered_cols=['venue.name', 'venue.catergories', 'venue.location.lat', 'venue.location.lng']</p>
  
  <p><strong>nearby_venues= nearby_venues.loc[: , filtered_cols]</strong></p>
  
  <p>nearby_venues['venue.categories']=nearby_venues.apply(getCAT, axis=1)</p>
  
  <p>nearby_venues.columns=[col.split(".")[-1] for col in nearby_venues.columns]</p>
  
  <p>nearby_venues.head()</p>
  
  <p>I get KeyError: 'Passing list-likes to .loc or [] with any missing labels is no longer supported on json file.</p>
  
  <p>if I comment out that part, it runs well but with limited result. What am I doing wrong?</p>