I'm trying to import a dataset of UK postcode districts UK postcode districts from Google Fusion tables into geopandas with the aim of splicing it to a dataset of house prices.

The problem is that geopandas doesn't seem to like either the CSV/KML version of the data.

If I use the command geopandas.from_file(path) then I receive the error:

DriverError: unsupported driver: u'CSV'

I have the same error when I try to import a KML version of the data (You can download the data below).

I'm sure it's trivial, but can anyone work out what I'm doing wrong?

UK postcode districts - KML

UK postcode districts - CSV

4 Answers 4


in case of csv, it probably would be easier to read it with pandas and then convert it to geopandas Dataframe

import pandas as pd
import geopandas as gp
from shapely.geometry import Point

stations = pd.read_csv('../data/stations.csv')
stations['geometry'] = stations.apply(lambda z: Point(z.X, z.Y), axis=1)
stations = gp.GeoDataFrame(stations)

The KML driver isn't enabled by default as detailed in this github issue https://github.com/Toblerity/Fiona/issues/97. Basically, the KML driver doesn't seem to meet Fiona's quality requirements (as of 2014), not sure if it will be fixed in the future.

You could try to read a simple/standard-enough KML as follows:

import geopandas as gpd
fiona.drvsupport.supported_drivers['kml'] = 'rw' # enable KML support which is disabled by default
fiona.drvsupport.supported_drivers['KML'] = 'rw' # enable KML support which is disabled by default


I've tried to read a file here and it gave me the following output:

enter image description here

Credits to this gist:


Edit 20191021: With newer versions of fiona, you might need to use libkml instead of kml. I.e.:

fiona.drvsupport.supported_drivers['libkml'] = 'rw' # enable KML support which is disabled by default
fiona.drvsupport.supported_drivers['LIBKML'] = 'rw' # enable KML support which is disabled by default
  • 2
    In addition, to convert the POLYGON Z to standard POLYGON you can do : df.geometry.map(lambda poly: shapely.ops.transform(lambda x, y, z: (x, y), poly))
    – MCMZL
    Oct 17, 2018 at 9:11
  • 1
    Yes, I had to explicitly enable it for LIBKML to read (google earth) .kml files Jul 6, 2020 at 14:19
  • Slightly shorter possible equivalent is fiona.supported_drivers['KML'] = 'rw' Mar 21 at 16:43

GeoPandas relies on the Fiona library (http://github.com/toblerity/Fiona) for the from_file() implementation. At this time Fiona, and therefore GeoPandas, does not support CSV or KML input. If you can convert them to GeoJSON or Shapefiles, then GeoPandas should be able to read without a problem.

  • Ah, I didn't realise that. Time to dig out a file converter. I understand that ogr2ogr is great.
    – elksie5000
    Sep 16, 2014 at 18:21

The current version of Fiona supports the CSV driver out of the box. You may have to specify the names of the latitude and longitude columns like this:

geopandas.read_file("file.csv", X_POSSIBLE_NAMES="X", Y_POSSIBLE_NAMES="Y")

More information about possible arguments for the csv driver can be found in the gdal driver documentation: https://gdal.org/drivers/vector/csv.html#open-options

  • Why was this downvoted? It works. Note if there are several possible column names, they have to be given as comma-separated string, and not a list: X_POSSIBLE_NAMES="X,lng", Y_POSSIBLE_NAMES="Y,lat"
    – hfs
    Aug 31, 2021 at 10:00

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.