Skip to content

Feature names that inherited from string cause an exception #45

Closed
resivalex opened this issue Jun 17, 2021 · 2 comments · Fixed by #46
Closed

Feature names that inherited from string cause an exception #45

resivalex opened this issue Jun 17, 2021 · 2 comments · Fixed by #46

Comments

@resivalex
Copy link
Contributor

resivalex commented Jun 17, 2021

I got a dataframe by pandas.read_sql_table. Every column name has a type sqlalchemy.sql.elements.quoted_name. Many checks in the source code rely on str, so fit_predict fails.

Should the library notify developers about unsupported column name types, convert them to strings or allow column names to have any type?

@resivalex resivalex changed the title Add support for non-string features Add support for non-string feature names Jun 17, 2021
@alexmryzhkov
Copy link
Contributor

Hi @resivalex,

Could you explain why sqlalchemy.sql.elements.quoted_name doesn't work as a str type? If you can share some test example with us, we will try to reproduce it on our side and fix.

Alex

@resivalex
Copy link
Contributor Author

lightautoml/dataset/np_pd_dataset.py:501

        if type(columns) is str:
            idx = self.data.columns.get_loc(columns)

        else:
            idx = self.data.columns.get_indexer(columns)

columns has type sqlalchemy.sql.elements.quoted_name, which isn't str, and execution goes to "else" branch

Test example https://www.kaggle.com/resivalex/non-string-feature-names-case/

@resivalex resivalex changed the title Add support for non-string feature names Feature names that inherited from string cause an exception Jun 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants