File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -2024,9 +2024,15 @@ def _get_feature_names(X):
2024
2024
if _is_pandas_df (X ):
2025
2025
# Make sure we can inspect columns names from pandas, even with
2026
2026
# versions too old to expose a working implementation of
2027
- # __dataframe__.column_names().
2028
- # TODO: remove once the minimum supported version of pandas has
2029
- # a working implementation of __dataframe__.column_names().
2027
+ # __dataframe__.column_names() and avoid introducing any
2028
+ # additional copy.
2029
+ # TODO: remove the pandas-specific branch once the minimum supported
2030
+ # version of pandas has a working implementation of
2031
+ # __dataframe__.column_names() that is guaranteed to not introduce any
2032
+ # additional copy of the data without having to impose allow_copy=False
2033
+ # that could fail with other libraries. Note: in the longer term, we
2034
+ # could decide to instead rely on the __dataframe_namespace__ API once
2035
+ # adopted by our minimally supported pandas version.
2030
2036
feature_names = np .asarray (X .columns , dtype = object )
2031
2037
elif hasattr (X , "__dataframe__" ):
2032
2038
df_protocol = X .__dataframe__ ()
You can’t perform that action at this time.
0 commit comments