-
Notifications
You must be signed in to change notification settings - Fork 169
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
Ability to internally store counts of each category in a CategoricalColumn #296
Conversation
…n_profile.py and test cases for categorical_column_profile.py that checks that categories is counted properly
|
||
self._categories = utils._combine_unique_sets( | ||
self._categories, df_series) | ||
self._categories.update(df_series.value_counts(dropna = False).to_dict()) |
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.
no spaces around the = here dropna=False
|
||
def dict_of_categories(self): | ||
""" | ||
Returns the dict of categories with the number of occurrences | ||
for each category. | ||
""" | ||
return dict(self._categories.items()) |
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.
Instead of dict_of_categories, we could do a functional property category_counts
and return a copy of the dict.
However, I suggest adding that to the subsequent PR which adds it to the profile.
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.
For now we can just remove this function.
dataprofiler/tests/profilers/test_categorical_column_profile.py
Outdated
Show resolved
Hide resolved
…rofile internally.
Head branch was pushed to by a user without write access
…olumn (capitalone#296) * added function to store counts of each category for categorical_column_profile.py and test cases for categorical_column_profile.py that checks that categories is counted properly * fixed grammer for categorical_column_profile.py * added test case to validate count is correct for categorical column profile internally. * removed unused function
I have allowed the system to track the counts of each category rather than just a list. Like, instead of just listing the categories like [a,b,c], we can now internally have a way to count each category. The categories will return as before like [a,b,c], but inside, _categories variable is now something like [a:1,b:2,c:3].