My script

import geopandas as gp
test = gp.GeoDataFrame(columns=['geometry', 'costs'])

the error:

File "/usr/local/lib/python3.7/dist-packages/geopandas/geodataframe.py", line 89, in__init__ super(GeoDataFrame, self).__init__(*args, **kwargs)
file "/usr/lib/python3/dist-packages/pandas/core/frame.py", line 348, in __init__ 
mgr = self._init_dict(data, index, columns, dtype=dtype)
File "/usr/lib/python3/dist-packages/pandas/core/frame.py", line 451, in _init_dict                                                                                                                      nan_dtype)
File "/usr/lib/python3/dist-packages/pandas/core/dtypes/cast.py", line 1196, in construct_1d_arraylike_from_scalar
dtype = dtype.dtype
AttributeError: type object 'object' has no attribute 'dtype'  

What could be the reason for that? It always worked for me like that. Now I had a software update and it suddenly does not work anymore.

  • 1
    Please add geopandas and pandas version Feb 18 at 13:03
  • 1
    Works for me geopandas.show_versions() -> [...] python: 3.9.1 [...] GDAL: 2.4.4 [...] geopandas: 0.8.2 [...] pandas: 1.2.2 Feb 18 at 13:23

Had the wrong pandas version.

pip3 install pandas == 1.2.2

fixed it for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.