DOC: detailing docstring and add lon & lat as args in points_from_xy()
See original GitHub issueI’m so glad to see the gpd.points_from_xy()
function in 0.5.0
. The function needs two args:
geometry = gpd.points_from_xy(df.longitude, df.latitude)
gdf = gpd.GeoDataFrame(df, geometry=geometry)
This requires the users to know the order of longitude and latitude. I wonder if they could be optional args so that the users don’t have to remember the order so
either
geometry = gpd.points_from_xy(lon=df.longitude, lat=df.latitude)
or
geometry = gpd.points_from_xy(lat=df.latitude, lon=df.longitude)
works.
Issue Analytics
- State:
- Created 4 years ago
- Comments:20 (11 by maintainers)
Top Results From Across the Web
Python Docstrings Tutorial : Examples & Format for Pydoc ...
Docstrings in Python Tutorial. Learn about Python Docstrings. Find different examples & format types of docstrings for Sphinx, Numpy and Pydoc.
Read more >Python Docstring: Documenting And Introspecting Functions
This tutorial explains what is Python Docstring and how to use it to document Python functions with examples.
Read more >Python Docstrings (With Examples) - Programiz
Python docstrings are the string literals that appear right after the definition of a function, method, class, or module. Let's take an example....
Read more >pandas docstring guide — pandas 1.5.2 documentation
A Python docstring is a string used to document a Python module, class, ... each parameter in the signature must be documented, including...
Read more >Documenting Python Code: A Complete Guide
Along with docstrings, Python also has the built-in function help() that prints out the objects docstring to the console. Here's a quick example:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Adding it to the docstring is certainly a good idea!
Giving an error message is not really possible I think, as it is difficult to detect (most often switching lon and lat gives some location on earth, just not the one you wanted).
On the other hand, some people use Geopandas to handle abstract datasets where latitude and longitude doesn’t really make sense while x and y works always. Even though you have to remember which is x and which y.