geopandas icon indicating copy to clipboard operation
geopandas copied to clipboard

ENH: harmonize read_file column selection keywords (support `columns` for fiona, support `ignore_fields`/`include_fields` for pyogrio for back compat)

Open jorisvandenbossche opened this issue 2 years ago • 3 comments

A couple of changes related to selecting columns in read_file:

  • Publicize to use columns (which I think the nicest API): explicitly add to the docstring (and will update the docs to mention it as well)
  • Translate columns to incude_fields for the fiona engine, so columns is always supported.
  • For the pyogrio engine, translate both include_fields and ignore_fields keywords that are supported by fiona to the columns keyword of pyogrio. This ensures a smooth upgrade when we switch the default for people that were using those keywords.
    • I did add a warning pointing to use columns instead, we can discuss whether we want to keep this warning (or make it stronger).

jorisvandenbossche avatar Jan 06 '24 14:01 jorisvandenbossche

+1 on keeping only columns in future.

martinfleis avatar Jan 17 '24 20:01 martinfleis

Probably a tangential issue but we should use column specification in GeoSeries.from_file to avoid reading attributes when we drop them anyway. Should be done once this is in.

martinfleis avatar Mar 17 '24 17:03 martinfleis

Updated the PR. Fixed the failing test (remaining failure is the dev build, failing for other reasons). And changed the UserWarning into a DeprecationWarning with the intent that eventually we only keep the columns keyword.

jorisvandenbossche avatar Mar 18 '24 12:03 jorisvandenbossche