0

Hello: I know this is not a new question. I've tried the possible solutions, but I still get module 'geopandas' has no attribute 'read_file. And I've checked geopandas document, http://geopandas.org/reference/geopandas.read_file.html, it seems to me geopandas has read_file attribute. Here are my codes:

import pandas as pd
import geopandas as gpd

shapefile = 'ne_110m_admin_0_countries.shp'
datafile = 'FIFA_1112.csv'

gdf = gpd.read_file(shapefile)[['ADMIN', 'ADM0_A3', 'geometry']]
gdf.columns = ['country', 'country_code', 'geometry']
gdf.head()

I got the error message:AttributeError: module 'geopandas' has no attribute 'read_file' Much appreciated for any suggestions, let me know if I've missed anything here.

  • 1
    How did you install geopandas? You might run the script from the folder where is another one called `geopandas`, so Python thinks that it is the module you are calling. – martinfleis Nov 19 '19 at 08:50
  • What do you get when you run `import geopandas as gpd;gpd.__version__` in a python terminal? – Tim.Lucas Nov 20 '19 at 20:52

0 Answers0