저는 현재 Joel Lawhead의 Python 지형 공간 분석 자습서를보고 있는데 쉐이프 파일을 편집하려고 할 때 오류가 발생합니다.새로운 Writer 객체를 통해 Python의 쉐이프 파일을 편집 할 수 없습니다.
사용중인 shapefile은 http://git.io/vLd8Y입니다. Jupyter Notebook에서 python3으로 코드를 실행하고 있습니다.
이것은 내 코드입니다. 나는 단순히 셰이프 파일을 Reader 개체 r
으로 읽고, w
과 r
같은 셰이프 유형을 가진 새로운 Writer 개체를 만듭니다. 그런 다음 r
의 레코드를 w
에 첨부하려고합니다.
import shapefile
r = shapefile.Reader("NYC_MUSEUMS_GEO")
w = shapefile.Writer(r.shapeType)
w.fields = list(r.fields)
w.records.extend(r.records())
그러나, 나는이 오류로 실행 해요 :
AttributeError Traceback (most recent call last)
<ipython-input-151-ceee096fbafa> in <module>()
6 w = shapefile.Writer(r.shapeType)
7 w.fields = list(r.fields)
----> 8 w.records.extend(r.records())
AttributeError: 'Writer' object has no attribute 'records'
어떤 아이디어 왜?