

def test_more_deeply_nested(self):
    data = [{
        'country': 'USA',
        'states': [{
            'name': 'California',
            'cities': [{
                'name': 'San Francisco',
                'pop': 12345,
            }, {
                'name': 'Los Angeles',
                'pop': 12346,
            }],
        }, {
            'name': 'Ohio',
            'cities': [{
                'name': 'Columbus',
                'pop': 1234,
            }, {
                'name': 'Cleveland',
                'pop': 1236,
            }],
        }],
    }, {
        'country': 'Germany',
        'states': [{
            'name': 'Bayern',
            'cities': [{
                'name': 'Munich',
                'pop': 12347,
            }],
        }, {
            'name': 'Nordrhein-Westfalen',
            'cities': [{
                'name': 'Duesseldorf',
                'pop': 1238,
            }, {
                'name': 'Koeln',
                'pop': 1239,
            }],
        }],
    }]
    result = json_normalize(data, ['states', 'cities'], meta=['country', ['states', 'name']])
    ex_data = {
        'country': ((['USA'] * 4) + (['Germany'] * 3)),
        'states.name': ['California', 'California', 'Ohio', 'Ohio', 'Bayern', 'Nordrhein-Westfalen', 'Nordrhein-Westfalen'],
        'name': ['San Francisco', 'Los Angeles', 'Columbus', 'Cleveland', 'Munich', 'Duesseldorf', 'Koeln'],
        'pop': [12345, 12346, 1234, 1236, 12347, 1238, 1239],
    }
    expected = DataFrame(ex_data, columns=result.columns)
    tm.assert_frame_equal(result, expected)

dataset/ETHPy150Open pydata/pandas/pandas/io/tests/json/test_json_norm.py TestJSONNormalize.test_more_deeply_nested/original