geopandas
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)
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
columnstoincude_fieldsfor the fiona engine, socolumnsis always supported. - For the pyogrio engine, translate both
include_fieldsandignore_fieldskeywords that are supported by fiona to thecolumnskeyword 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
columnsinstead, we can discuss whether we want to keep this warning (or make it stronger).
- I did add a warning pointing to use
+1 on keeping only columns in future.
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.
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.