import geopandas as gpd # 读取township.shp文件 file_path = 'data1/township.shp' data = gpd.read_file(file_path) # 读取name字段中“志远县”图斑的个数 count_zhiyuan = len(data[data['name'] == '志远县']) # 读取area字段(面积),并计算“罗丰县”的面积之和 sum_luofeng = data[data['name'] == '罗丰县']['area'].sum() print("志远县图斑个数:", count_zhiyuan) print("罗丰县面积之和:", sum_luofeng) [2024-06-30 04:06:24 | AI写代码神器 | 266点数解答]