Python ';不支持的驱动程序';将Geodataframe写入geopandas中的文件时出错

Python ';不支持的驱动程序';将Geodataframe写入geopandas中的文件时出错,python,file,anaconda,geopandas,Python,File,Anaconda,Geopandas,我正在读取一个GeoJson文件,对其应用一些函数,然后想将GeoDataFrame保存到另一个文件中 这是我的密码: import geopandas as gpd df=gpd.read_file('C:/in_folder/data.json') df.to_file(driver='C:/out_folder', filename='df.json') 但这会产生以下错误: 驱动程序错误:不支持的驱动程序:“C:/out\u文件夹” 以下是回溯: -------------------

我正在读取一个GeoJson文件,对其应用一些函数,然后想将GeoDataFrame保存到另一个文件中

这是我的密码:

import geopandas as gpd
df=gpd.read_file('C:/in_folder/data.json')
df.to_file(driver='C:/out_folder', filename='df.json')
但这会产生以下错误:

驱动程序错误:不支持的驱动程序:“C:/out\u文件夹”

以下是回溯:

---------------------------------------------------------------------------
DriverError                               Traceback (most recent call last)
<ipython-input-75-4209247a0f42> in <module>
      1 import geopandas as gpd
      2 df=gpd.read_file('C:/in_folder/data.json')
      3 df.to_file(driver='C:/out_folder', filename='df.json')

~\.conda\envs\ox\lib\site-packages\geopandas\geodataframe.py in to_file(self, filename, driver, schema, **kwargs)
    513         from geopandas.io.file import to_file
    514 
--> 515         to_file(self, filename, driver, schema, **kwargs)
    516 
    517     def to_crs(self, crs=None, epsg=None, inplace=False):

~\.conda\envs\ox\lib\site-packages\geopandas\io\file.py in to_file(df, filename, driver, schema, **kwargs)
    125         schema = infer_schema(df)
    126     with fiona_env():
--> 127         with fiona.open(
    128             filename, "w", driver=driver, crs=df.crs, schema=schema, **kwargs
    129         ) as colxn:

~\.conda\envs\ox\lib\site-packages\fiona\env.py in wrapper(*args, **kwargs)
    396     def wrapper(*args, **kwargs):
    397         if local._env:
--> 398             return f(*args, **kwargs)
    399         else:
    400             if isinstance(args[0], str):

~\.conda\envs\ox\lib\site-packages\fiona\__init__.py in open(fp, mode, driver, schema, crs, encoding, layer, vfs, enabled_drivers, crs_wkt, **kwargs)
    260             else:
    261                 this_schema = None
--> 262             c = Collection(path, mode, crs=crs, driver=driver, schema=this_schema,
    263                            encoding=encoding, layer=layer, enabled_drivers=enabled_drivers, crs_wkt=crs_wkt,
    264                            **kwargs)

~\.conda\envs\ox\lib\site-packages\fiona\collection.py in __init__(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, **kwargs)
    126                 raise DriverError("no driver")
    127             elif driver not in supported_drivers:
--> 128                 raise DriverError(
    129                     "unsupported driver: %r" % driver)
    130             elif self.mode not in supported_drivers[driver]:

DriverError: unsupported driver: 'C:/out_folder'
---------------------------------------------------------------------------
DriverError回溯(最近一次呼叫上次)
在里面
1作为gpd导入geopandas
2 df=gpd.read_文件('C:/in_folder/data.json')
3 df.to_文件(driver='C:/out_folder',filename='df.json')
to\ U文件中的~\.conda\envs\ox\lib\site packages\geopandas\geodataframe.py(self、文件名、驱动程序、模式,**kwargs)
513从geopandas.io.file导入到_文件
514
-->515到_文件(self、文件名、驱动程序、模式,**kwargs)
516
517 def to_crs(自身,crs=无,epsg=无,就地=假):
to\ U文件中的~\.conda\envs\ox\lib\site packages\geopandas\io\file.py(df、文件名、驱动程序、模式,**kwargs)
125模式=推断模式(df)
126与fiona_env()
>127与菲奥娜。
128文件名,“w”,driver=driver,crs=df.crs,schema=schema,**kwargs
129)作为colxn:
包装中的~\.conda\envs\ox\lib\site packages\fiona\env.py(*args,**kwargs)
396 def包装(*args,**kwargs):
397如果是本地环境:
-->398返回f(*args,**kwargs)
399其他:
400如果存在(参数[0],str):
~\.conda\envs\ox\lib\site packages\fiona\\uuu init\uuuuuuuuuuuuuuuuuuupy处于打开状态(fp、模式、驱动程序、模式、crs、编码、层、vfs、启用的驱动程序、crs\uwkt、**kwargs)
260其他:
261此模式=无
-->262 c=集合(路径、模式、crs=crs、驱动程序=驱动程序、模式=此模式,
263编码=编码,层=层,启用的驱动程序=启用的驱动程序,crs\U wkt=crs\U wkt,
264**夸尔格)
_uuinit_uu中的~\.conda\envs\ox\lib\site packages\fiona\collection.py(self、path、mode、driver、schema、crs、encoding、layer、vsi、archive、enabled_drivers、crs_wkt、ignore_字段、ignore_几何体、**kwargs)
126升起驱动器错误(“无驱动器”)
127 elif驱动程序不在受支持的驱动程序中:
-->128升起驱动器错误(
129“不受支持的驱动程序:%r”%driver)
130 elif self.mode不在受支持的_驱动程序[驱动程序]中:
DriverError:不支持的驱动程序:“C:/out\u文件夹”

有人知道发生了什么事吗

驱动程序关键字必须是文件格式,如“ESRI Shapefile”或“GeoJSON”等

要查看所有受支持的驱动程序,您可以运行(具体输出取决于您的安装):

>>> import fiona
>>> fiona.supported_drivers
{'AeronavFAA': 'r',
 'ARCGEN': 'r',
 'BNA': 'raw',
 'DXF': 'raw',
 'CSV': 'raw',
 'OpenFileGDB': 'r',
 'ESRIJSON': 'r',
 'ESRI Shapefile': 'raw',
 'GeoJSON': 'rw',
 'GeoJSONSeq': 'rw',
 'GPKG': 'rw',
 'GML': 'raw',
 'GPX': 'raw',
 'GPSTrackMaker': 'raw',
 'Idrisi': 'r',
 'MapInfo File': 'raw',
 'DGN': 'raw',
 'PCIDSK': 'r',
 'S57': 'r',
 'SEGY': 'r',
 'SUA': 'r',
 'TopoJSON': 'r'}