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

List now maintains same visual data representation #363

Merged
merged 3 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion dataprofiler/profilers/profile_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,7 @@ def _update_profile_from_chunk(self, data, sample_size,
if isinstance(data, pd.Series):
data = data.to_frame()
elif isinstance(data, list):
data = pd.DataFrame(data)
data = pd.DataFrame(data, dtype=object)

# Calculate schema of incoming data
mapping_given = defaultdict(list)
Expand Down
15 changes: 13 additions & 2 deletions dataprofiler/tests/profilers/test_profile_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ def test_bad_input_data(self, *mocks):
@mock.patch('dataprofiler.profilers.profile_builder.'
'StructuredProfiler._update_correlation')
def test_list_data(self, *mocks):
data = [1, None, 3, 4, 5, None, 1]
data = [[1, 1],
[None, None],
[3, 3],
[4, 4],
[5, 5],
[None, None],
[1, 1]]
with test_utils.mock_timeit():
profiler = dp.StructuredProfiler(data)

Expand All @@ -97,10 +103,15 @@ def test_list_data(self, *mocks):
self.assertEqual(2, profiler.row_is_null_count)
self.assertEqual(7, profiler.total_samples)
self.assertEqual(5, len(profiler.hashed_row_dict))
self.assertListEqual([0], list(profiler._col_name_to_idx.keys()))
self.assertListEqual([0, 1], list(profiler._col_name_to_idx.keys()))
self.assertIsNone(profiler.correlation_matrix)
self.assertDictEqual({'row_stats': 1}, profiler.times)

# validates the sample out maintains the same visual data format as the
# input.
self.assertListEqual(['5', '1', '1', '3', '4'],
profiler.profile[0].sample)

@mock.patch('dataprofiler.profilers.profile_builder.'
'ColumnPrimitiveTypeProfileCompiler')
@mock.patch('dataprofiler.profilers.profile_builder.'
Expand Down