Cell In[12], line 26, in create_absence_points(presence, total_area, radius, count)
23 res_difference = total_area.overlay(presence_bfr, how='difference')
25 # 임의지점 생성 함수
---> 26 absence = random_points_in_gdf(res_difference, count)
27 absence['CLASS'] = 0
28 return absence
Cell In[12], line 40, in random_points_in_gdf(gdf, size, overestimate)
38 multipoint = multipoint.intersection(polygon)
39 samples = np.array(multipoint)
---> 40 points = samples[np.random.choice(len(samples), size)]
41 df = pd.DataFrame(points, columns=['lon', 'lat'])
42 return gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.lon, df.lat))
TypeError: len() of unsized object
제가 파이선을 제대로 사용해 본 경험이 없어서..예제 파일로 이제서야 돌려보고 있습니다. 126~131줄 실행하니 위와 같은 메세지가 뜨는데, sample에 들어가는 정보가 없는걸까요 아니면 길이를 알 수 없는 데이터가 들어가서 일까요..??? 전 코드 대로 실행했는데 어디서 잘못된 건지 잘 모르겠습니다. intersection하는 객체가 없어서 일까도 궁금하고요.
Cell In[12], line 26, in create_absence_points(presence, total_area, radius, count)
23 res_difference = total_area.overlay(presence_bfr, how='difference')
25 # 임의지점 생성 함수
---> 26 absence = random_points_in_gdf(res_difference, count)
27 absence['CLASS'] = 0
28 return absence
Cell In[12], line 40, in random_points_in_gdf(gdf, size, overestimate)
38 multipoint = multipoint.intersection(polygon)
39 samples = np.array(multipoint)
---> 40 points = samples[np.random.choice(len(samples), size)]
41 df = pd.DataFrame(points, columns=['lon', 'lat'])
42 return gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.lon, df.lat))
TypeError: len() of unsized object
제가 파이선을 제대로 사용해 본 경험이 없어서..예제 파일로 이제서야 돌려보고 있습니다. 126~131줄 실행하니 위와 같은 메세지가 뜨는데, sample에 들어가는 정보가 없는걸까요 아니면 길이를 알 수 없는 데이터가 들어가서 일까요..??? 전 코드 대로 실행했는데 어디서 잘못된 건지 잘 모르겠습니다. intersection하는 객체가 없어서 일까도 궁금하고요.