我正在尝试合并一个 cudf 数据框和一个 geopandas 数据框。
df = df.merge(parishes[['NAME_3', 'area']], left_on='Parish', right_on='NAME_3').drop(columns=['NAME_3'])
df
是一个 cudf 数据框,parishes
是一个 geopandas 数据框。
在运行上述行时,出现以下错误:
TypeError Traceback (most recent call last)
<ipython-input-40-5143535bcf20> in <module>()
----> 1 df = df.merge(parishes[['NAME_3', 'area']], left_on='Parish', right_on='NAME_3').drop(columns=['NAME_3'])
5 frames
/usr/local/lib/python3.7/site-packages/cudf/core/join/join.py in _validate_merge_params(lhs, rhs, on, left_on, right_on, left_index, right_index, how, suffixes)
414
415 # If nothing specified, must have common cols to use implicitly
--> 416 same_named_columns = set(lhs._data) & set(rhs._data)
417 if (
418 not (left_index or right_index)
TypeError: 'BlockManager' object is not iterable
有什么问题?有人可以帮我弄这个吗 ?这是我第一次使用 cudf 数据帧,所以我不确定是什么导致了这个问题。
答案 0 :(得分:3)
cudf
和 geopandas
彼此不兼容(目前)。您应该能够使用例如 cudf
将 geopandas 数据框中的所有非几何列移动到 gpu_df = cudf.from_pandas(df[['Parishes', 'name_3']])
中,然后您可以将该 gpu_df 与任何其他 cudf
数据帧合并。 cudf 目前在其路线图上没有 geometry
数据类型,但直接依赖于 cuspatial
的 cudf
(https://github.com/rapidsai/cuspatial) 有。当 6 月 21.06 发布时,cuspatial
将支持 geometry
列,让您可以更轻松地将 cudf
和 cuspatial
的所有强大功能用于 geopandas。>