Skip to content
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

Merged
merged 3 commits into from
Nov 11, 2021
Merged

Drop column with no information #736

merged 3 commits into from
Nov 11, 2021

Conversation

George3d6
Copy link
Contributor

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

@George3d6 George3d6 added the enhancement New feature or request label Nov 8, 2021
Copy link
Contributor

@paxcema paxcema left a 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.

@@ -210,7 +210,12 @@ def get_identifier_description_mp(arg_tup):

def get_identifier_description(data, column_name, data_dtype):
Copy link
Contributor

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)
Copy link
Contributor

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?

Copy link
Contributor

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())

if nr_unique == 1:
return 'No Information'

unquie_pct = nr_unique / len(data)
Copy link
Contributor

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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" ?

@George3d6 George3d6 merged commit cc3b08c into staging Nov 11, 2021
@paxcema paxcema mentioned this pull request Nov 17, 2021
@hamishfagg hamishfagg deleted the drop_no_inf_cols branch December 10, 2024 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants