我将csv解析为pandas,然后解析为geopandas from here
我创建了stations
DataFrame,其中包含以下内容:
stations_pd['pos'] = [Point(loc[0], loc[1]) for loc in locs]
然后我从中创建了地址:
stations_gpd = gpd.GeoDataFrame(stations_pd)
并希望将其转储到HDFStore:
store = pd.HDFStore("test.h5")
store['pd'] = stations_pd
这很好,但与geopnadas相同会引发错误:
store['gpd'] = stations_gpd
错误是:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/io/pytables.py", line 486, in __setitem__
self.put(key, value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/io/pytables.py", line 866, in put
self._write_to_group(key, value, append=append, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/io/pytables.py", line 1323, in _write_to_group
encoding=encoding, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/io/pytables.py", line 1237, in _create_storer
error('_TYPE_MAP')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/io/pytables.py", line 1213, in error
% (t, group, type(value), format, append, kwargs)
TypeError: cannot properly create the storer for: [_TYPE_MAP] [group->/stations (Group) '',value-><class 'geopandas.geodataframe.GeoDataFrame'>,format->fixed,append->False,kwargs->{'encoding': None}]