-
Notifications
You must be signed in to change notification settings - Fork 185
UnstructuredProfiler: Added NoImplementationError #907
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
Changes from all commits
5bf542a
1e24ca5
a578339
3bec151
93072c2
859f486
5079ec4
cdfa89c
3868fcf
74c557e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1364,6 +1364,24 @@ def report(self, report_options: dict = None) -> dict: | |
| report["data_stats"] = self._profile.report(remove_disabled_flag) | ||
| return _prepare_report(report, output_format, omit_keys) | ||
|
|
||
| @classmethod | ||
| def load_from_dict( | ||
|
||
| cls, | ||
| data, | ||
| options: dict | None = None, | ||
| ): | ||
| """ | ||
| Parse attribute from json dictionary into self. | ||
|
|
||
| :param data: dictionary with attributes and values. | ||
| :type data: dict[string, Any] | ||
| :param options: options for loading column profiler params from dictionary | ||
| :type options: Dict | None | ||
|
|
||
| :raises: NotImplementedError | ||
| """ | ||
| raise NotImplementedError("UnstructuredProfiler deserialization not supported.") | ||
|
|
||
| @utils.method_timeit(name="clean_and_base_stats") | ||
| def _clean_data_and_get_base_stats( | ||
| self, data: pd.Series, sample_size: int, min_true_samples: int = None | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3270,6 +3270,25 @@ def test_min_true_samples(self, *mocks): | |
| profile = dp.UnstructuredProfiler(empty_df, min_true_samples=10) | ||
| self.assertEqual(10, profile._min_true_samples) | ||
|
|
||
| def test_encode(self, *mocks): | ||
|
||
| profiler = UnstructuredProfiler(None) | ||
| with self.assertRaisesRegex( | ||
| NotImplementedError, "UnstructuredProfiler serialization not supported." | ||
| ): | ||
| json.dumps(profiler, cls=ProfileEncoder) | ||
|
|
||
| def test_decode(self, *mocks): | ||
| with self.assertRaisesRegex( | ||
| ValueError, "Invalid profiler class UnstructuredProfiler failed to load." | ||
| ): | ||
| load_profiler({"class": "UnstructuredProfiler", "data": {}}) | ||
|
||
|
|
||
| def test_load_from_dict(self, *mocks): | ||
| with self.assertRaisesRegex( | ||
| NotImplementedError, "UnstructuredProfiler deserialization not supported." | ||
| ): | ||
| UnstructuredProfiler.load_from_dict({}, None) | ||
|
|
||
|
|
||
| class TestUnstructuredProfilerWData(unittest.TestCase): | ||
| @classmethod | ||
|
|
||
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.
changes
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.
good