def sample_geojson(stream, max_features):
    data, features = ijson.parse(stream), list()

    for (prefix1, event1, value1) in data:
        if event1 != 'start_map':
            # A root GeoJSON object is a map.
            raise ValueError((prefix1, event1, value1))

        for (prefix2, event2, value2) in data:
            if event2 == 'map_key' and value2 == 'type':
                prefix3, event3, value3 = next(data)
            
                if event3 != 'string' and value3 != 'FeatureCollection':
                    # We only want GeoJSON feature collections
                    raise ValueError((prefix3, event3, value3))
            
            elif event2 == 'map_key' and value2 == 'features':
                prefix4, event4, value4 = next(data)
            
                if event4 != 'start_array':
                    # We only want lists of features here.
                    raise ValueError((prefix4, event4, value4))
            
                for (prefix5, event5, value5) in data:
                    if event5 == 'end_array' or len(features) == max_features:
                        break
                
                    # let _build_value() handle the feature.
                    _data = chain([(prefix5, event5, value5)], data)
                    features.append(_build_value(_data))

                geojson = dict(type='FeatureCollection', features=features)
                return json.dumps(geojson)
    
    raise ValueError()
Read data into a DataFrame, but check to see if it is in a cache first.
dataset/ETHPy150Open openaddresses/machine/openaddr/sample.py/sample_geojson--crossover with--dataset/ETHPy150Open QuantSoftware/QuantSoftwareToolkit/QSTK/qstkutil/DataAccess.py/DataAccess.get_data