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
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lightwood/helpers/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

unquie_pct = len(set(data)) / len(data)
nr_unique = len(set(data))

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


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

Expand Down