question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DOC: import geopandas recommendation

See original GitHub issue

Now in most places, we do

import geopandas as gpd

and it is certainly good to be consistent.

However, I wanted to check what the appetite is for changing this to a version without the aliasing. So just import geopandas, and then geopandas.read_file(..), geopandas.sjoin(..), … In case you use eg GeoDataFrame a lot, you can also do from geopandas import GeoDataFrame.

The reason for this is that from some recent conversations, I got convinced that ideally, you choose a package name such that you don’t need to shorten the import, as doing that creates additional overhead (it is less directly recognizable in the code where something is coming from if you are less familiar with the package, you get different aliases used in the wild, …). I personally think geopandas is short enough (and you typically use mainly method calls) to not need an alias, but on the other hand, it might also be a bit late to change this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jdmcbrcommented, Jul 7, 2018

I’m with @kuanb on this one; so long as import pandas as pd is the standard, sticking with import geopandas as gpd seems like it is fairly clear.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation — GeoPandas 0.12.2+0.gefcb367.dirty ...
We strongly recommend to either install everything from the defaults channel, or everything from the conda-forge channel. Ending up with a mixture of...
Read more >
Working with geopandas (shapefiles) - Regionmask
import cartopy.crs as ccrs import geopandas as gp import ... to file '/home/docs/.cache/pooch/7dd514faeaa71efe73294dece9245e99-continents.zip'.
Read more >
Convert local file (shp/CSV) into Earth Engine (EE) object
You can convert your dataframe to GeoJSON (https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.to_json.html).
Read more >
Introduction to Geopandas — Intro to Python GIS documentation
Import necessary modules In [1]: import geopandas as gpd # Set filepath (fix path ... the coordinate reference system (projection) for the GeoDataFrame....
Read more >
Cannot import Geopandas with PyInstaller executable
Geopandas is installed correctly within the Python 3.6.3 virtual environment (through PIP, I've tried versions 0.4 and 0.3 as well) and works ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found