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

Encode categorical column #770

Merged
merged 4 commits into from
Mar 20, 2023

Conversation

kshitijavis
Copy link
Contributor

No description provided.

@kshitijavis kshitijavis force-pushed the encode_categorical_column branch from 5cfd109 to 9989370 Compare March 7, 2023 19:34
@taylorfturner taylorfturner enabled auto-merge (squash) March 7, 2023 19:35
Copy link
Contributor

@taylorfturner taylorfturner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to just be testing json.dumps is there not a new function / method on classes that we want to test here?

Comment on lines 76 to 88
exepcted = json.dumps(
{
"name": profile.name,
"col_index": profile.col_index,
"sample_size": profile.sample_size,
"metadata": profile.metadata,
"times": profile.times,
"thread_safe": profile.thread_safe,
"_categories": profile._categories,
"_CategoricalColumn__calculations": {},
"_top_k_categories": profile._top_k_categories,
}
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend making this more test-driven development.. instead of assigning expected values from the profile object itself.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah instead of using the profile. these values should be literals. This is to prevent changes from going under the radar and forcing the test to have specific values, rather than change with your profile object.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as my comment above

profile.update(df_categorical)

serialized = json.dumps(profile, cls=ProfileEncoder)
exepcted = json.dumps(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected typo

}
)

self.assertEqual(json.loads(serialized), json.loads(expected))
Copy link
Contributor

@micdavis micdavis Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are trying to test the functionality of encoding and decoding (profile -> json -> profile) then I think that the assertEqual() should be comparing the decoded data (json -> profile) to another profile object that represents the object we expect as a result.

Comment on lines 76 to 88
exepcted = json.dumps(
{
"name": profile.name,
"col_index": profile.col_index,
"sample_size": profile.sample_size,
"metadata": profile.metadata,
"times": profile.times,
"thread_safe": profile.thread_safe,
"_categories": profile._categories,
"_CategoricalColumn__calculations": {},
"_top_k_categories": profile._top_k_categories,
}
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as my comment above

Copy link
Contributor

@taylorfturner taylorfturner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a couple tweaks prior to merging

@taylorfturner taylorfturner added Medium Priority Significant improvement or bug / feature reducing overall performance New Feature A feature addition not currently in the library labels Mar 8, 2023
auto-merge was automatically disabled March 16, 2023 21:05

Head branch was pushed to by a user without write access

@taylorfturner taylorfturner enabled auto-merge (squash) March 16, 2023 21:15
auto-merge was automatically disabled March 16, 2023 23:25

Head branch was pushed to by a user without write access

@taylorfturner taylorfturner enabled auto-merge (squash) March 17, 2023 12:43
@taylorfturner taylorfturner merged commit 3db5836 into capitalone:main Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Medium Priority Significant improvement or bug / feature reducing overall performance New Feature A feature addition not currently in the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants