-
Notifications
You must be signed in to change notification settings - Fork 93
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
Drop column with no information #736
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, may be worth moving these modules to a separate identification module, but as far as dropping uninformative columns this seems OK to me.
lightwood/helpers/text.py
Outdated
@@ -210,7 +210,12 @@ def get_identifier_description_mp(arg_tup): | |||
|
|||
def get_identifier_description(data, column_name, data_dtype): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type hint
data: Iterable, column_name: str, data_dtype: str
@@ -210,7 +210,12 @@ def get_identifier_description_mp(arg_tup): | |||
|
|||
def get_identifier_description(data, column_name, data_dtype): | |||
data = list(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we make this a list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's already in a series form you can simply do something like len(data.unique())
lightwood/helpers/text.py
Outdated
if nr_unique == 1: | ||
return 'No Information' | ||
|
||
unquie_pct = nr_unique / len(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix the spelling
if nr_unique == 1: | ||
return 'No Information' | ||
|
||
unquie_pct = nr_unique / len(data) | ||
|
||
spaces = [len(str(x).split(' ')) - 1 for x in data] | ||
mean_spaces = np.mean(spaces) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we doing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to mark the column for dropping under the "identifier / foreign-keys" rule, if this function returns a string (rather than None
) the column is dropped, maybe the interface is confusing. And maybe we should broaden the definition of "identifier" to something like "no_information" ?
Dropping columns that don't have any information (a single unique value)
Currently no test for this since
get_identifier_description
has no tests (maybe todo for later) and this is so dumb it's not the first thing I'd want to test, see mindsdb/type_infer#31