1

I'm trying to merge a cudf dataframe and a geopandas dataframe.

df = df.merge(parishes[['NAME_3', 'area']], left_on='Parish', right_on='NAME_3').drop(columns=['NAME_3'])

df is a cudf dataframe and parishes is a geopandas dataframe.

On running the above line, I get the below error :

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

What is the problem ? Can someone help me with this ? This is the first time I'm using cudf dataframes, so I am not sure what is causing the issue.

AnonymousMe
  • 509
  • 1
  • 5
  • 18

1 Answers1

4

cudf and geopandas aren't compatible with one another (yet). You should be able to move all of the non-geometry columns in your geopandas dataframe into cudf using, for example, gpu_df = cudf.from_pandas(df[['Parishes', 'name_3']]), then you can merge that gpu_df with any other cudf DataFrame. cudf doesn't have geometry datatypes on its roadmap currently, but cuspatial (https://github.com/rapidsai/cuspatial), which depends directly on cudf, does. When 21.06 releases in June cuspatial will have support for geometry columns and make it easier for you to use all the power of cudf and cuspatial with anything from geopandas.

Thomson Comer
  • 3,919
  • 3
  • 30
  • 32