Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python:shapefile.Reader,如何设置.iloc?_Python_Shapefile - Fatal编程技术网

Python:shapefile.Reader,如何设置.iloc?

Python:shapefile.Reader,如何设置.iloc?,python,shapefile,Python,Shapefile,当我在dataframe或geodataframe上迭代并想要设置某个部分时,我使用df.iloc[0:100]。当我使用shapefile.Reader时,如何设置某些节?例如,0-100行 生成器不可下标,iterRecords返回生成器。相反,请使用形状记录或记录。它会给你一个列表 rows = shapefile.Reader(shapefile_path).shapeRecords()[0:100] for row_num, row in enumerate(rows): p

当我在dataframe或geodataframe上迭代并想要设置某个部分时,我使用df.iloc[0:100]。当我使用shapefile.Reader时,如何设置某些节?例如,0-100行


生成器不可下标,iterRecords返回生成器。相反,请使用形状记录或记录。它会给你一个列表

rows = shapefile.Reader(shapefile_path).shapeRecords()[0:100]

for row_num, row in enumerate(rows):
    print(row_num, row)
rows = shapefile.Reader(shapefile_path).shapeRecords()[0:100]

for row_num, row in enumerate(rows):
    print(row_num, row)