Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise error if function is used with parameters to read no geometry, columns, or fids #280

Conversation

theroggy
Copy link
Member

@theroggy theroggy commented Sep 3, 2023

Necessary changes and tests to ensure following behaviour for both use_arrow=True and use_arrow=False:

  • if columns=[], read_geometry=False and return_fid/fid_as_index=False, a ValueError is raised
  • if columns=[], read_geometry=False and return_fid/fid_as_index=True, the index is read and returned
  • if none of the above, but fid_as_index=False and the result ends up having no geometry nor attribute columns (eg. because the input file doesn't have a geometry column and columns=[]), an empty DataFrame is returned.

closes #263

@theroggy theroggy changed the title Raise error if read or read_dataframe are called with parameters so no geometry no columns and no fids are asked Raise error if read or read_dataframe are called with parameters to read no geometry, no columns and no fids Sep 3, 2023
@theroggy theroggy marked this pull request as ready for review September 3, 2023 16:06
@theroggy theroggy marked this pull request as draft September 3, 2023 16:14
@theroggy theroggy changed the title Raise error if read or read_dataframe are called with parameters to read no geometry, no columns and no fids Raise error if file is read with parameters to read no geometry, no columns and no fids Sep 3, 2023
@theroggy theroggy changed the title Raise error if file is read with parameters to read no geometry, no columns and no fids Raise error if function is used with parameters to read no geometry, no columns and no fids Sep 3, 2023
@theroggy theroggy marked this pull request as ready for review September 3, 2023 18:07
Copy link
Member

@brendan-ward brendan-ward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @theroggy !

A few minor suggestions...

CHANGES.md Outdated Show resolved Hide resolved
pyogrio/_io.pyx Outdated Show resolved Hide resolved
pyogrio/_io.pyx Outdated Show resolved Hide resolved
pyogrio/tests/test_geopandas_io.py Outdated Show resolved Hide resolved
@theroggy theroggy changed the title Raise error if function is used with parameters to read no geometry, no columns and no fids Raise error if function is used with parameters to read no geometry, columns, or fids Sep 5, 2023
@theroggy
Copy link
Member Author

theroggy commented Sep 5, 2023

@brendan-ward I resolved your suggestions.

@brendan-ward brendan-ward merged commit 9cfdc7f into geopandas:main Sep 6, 2023
17 checks passed
@theroggy theroggy deleted the Raise-error-if-no-geometry-nor-any-columns-asked-to-be-read branch September 6, 2023 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use_arrow=True vs False: different empty dataframe result when no columns fetched
2 participants