Skip to content
Open
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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ repos:
h5py>=2.10.0,
wheel>=0.33.1,
numpy<2.0.0,
pandas>=1.1.2,
'pandas>=1.1.2,<3.0.0',
python-dateutil>=2.7.5,
pytz>=2020.1,
pyarrow>=1.0.1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,11 @@ def test_categorical_diff(self):
},
}
actual_diff = profile.diff(profile2)
self.assertAlmostEqual(
expected_diff.get("statistics").get("chi2-test").pop("p-value"),
actual_diff.get("statistics").get("chi2-test").pop("p-value"),
places=10,
)
self.assertDictEqual(expected_diff, actual_diff)

# Test with one categorical column matching
Expand Down
29 changes: 29 additions & 0 deletions dataprofiler/tests/profilers/test_column_profile_compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,19 @@ def test_diff_primitive_compilers(self):
profile_diff["statistics"].pop("median_absolute_deviation"),
places=2,
)
self.assertAlmostEqual(
expected_diff["statistics"].get("t-test").get("welch").pop("p-value"),
profile_diff["statistics"].get("t-test").get("welch").pop("p-value"),
places=10,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

QQ- I see some of these assertions are at 2 earlier in the file and others are at 10. Do you mind explaining the difference?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure! The places indicate the precision of the almost equal, in this case 10 decimal places. So the intention here to be as close as possible despite floating point precision issues (possibly due to python versions).

I cannot say why the previous ones were only set to to two places.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@shania-m if you have any other questions, lmk!

)
self.assertAlmostEqual(
expected_diff["statistics"]
.get("t-test")
.get("conservative")
.pop("p-value"),
profile_diff["statistics"].get("t-test").get("conservative").pop("p-value"),
places=10,
)
self.assertDictEqual(expected_diff, profile_diff)

# Test different compilers
Expand Down Expand Up @@ -354,6 +367,22 @@ def test_disabling_columns_during_primitive_diff(self):
profile_diff["statistics"].pop("median_absolute_deviation"),
places=2,
)
self.assertAlmostEqual(
expected_diff.get("statistics").get("t-test").get("welch").pop("p-value"),
profile_diff.get("statistics").get("t-test").get("welch").pop("p-value"),
places=10,
)
self.assertAlmostEqual(
expected_diff.get("statistics")
.get("t-test")
.get("conservative")
.pop("p-value"),
profile_diff.get("statistics")
.get("t-test")
.get("conservative")
.pop("p-value"),
places=10,
)
self.assertDictEqual(expected_diff, profile_diff)

# Test disabling all columns in one compiler
Expand Down
5 changes: 5 additions & 0 deletions dataprofiler/tests/profilers/test_float_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1728,6 +1728,11 @@ def test_diff(self):
np.testing.assert_almost_equal(
sorted(expected_diff_mode[i]), sorted(diff_mode[i]), 2
)
self.assertAlmostEqual(
expected_diff.get("t-test").get("welch").pop("p-value"),
profile_diff.get("t-test").get("welch").pop("p-value"),
places=10,
)
self.assertAlmostEqual(
expected_diff.pop("median_absolute_deviation"),
profile_diff.pop("median_absolute_deviation"),
Expand Down
5 changes: 5 additions & 0 deletions dataprofiler/tests/profilers/test_int_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,11 @@ def test_diff(self):
np.testing.assert_almost_equal(
sorted(expected_diff_mode[i]), sorted(diff_mode[i]), 2
)
self.assertAlmostEqual(
expected_diff.get("t-test").get("welch").pop("p-value"),
profile_diff.get("t-test").get("welch").pop("p-value"),
places=10,
)
self.assertAlmostEqual(
expected_diff.pop("median_absolute_deviation"),
profile_diff.pop("median_absolute_deviation"),
Expand Down
8 changes: 6 additions & 2 deletions dataprofiler/tests/profilers/test_profile_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2156,9 +2156,13 @@ def test_diff_categorical_chi2_test(self, *mocks):
"deg_of_free": 2,
"p-value": 0.3099238764710244,
}
self.assertDictEqual(
expected_chi2_test_dict, diff["data_stats"][0]["statistics"]["chi2-test"]
chi2_diff = diff["data_stats"][0]["statistics"]["chi2-test"]
self.assertAlmostEqual(
expected_chi2_test_dict.pop("p-value"),
chi2_diff.pop("p-value"),
places=10,
)
self.assertDictEqual(expected_chi2_test_dict, chi2_diff)

@mock.patch(
"dataprofiler.profilers.data_labeler_column_profile.DataLabelerColumn.update"
Expand Down
5 changes: 5 additions & 0 deletions dataprofiler/tests/profilers/test_text_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,11 @@ def test_diff(self):
np.testing.assert_almost_equal(
sorted(expected_diff_mode[i]), sorted(diff_mode[i]), 2
)
self.assertAlmostEqual(
expected_diff.get("t-test").get("welch").pop("p-value"),
profile_diff.get("t-test").get("welch").pop("p-value"),
places=10,
)
self.assertAlmostEqual(
expected_diff.pop("median_absolute_deviation"),
profile_diff.pop("median_absolute_deviation"),
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
h5py>=2.10.0
wheel>=0.33.1
numpy<2.0.0
pandas>=1.1.2
pandas>=1.1.2,<3.0.0
python-dateutil>=2.7.5
pytz>=2020.1
pyarrow>=1.0.1
chardet>=3.0.4
chardet>=3.0.4,<7.0.0
fastavro>=1.1.0
python-snappy>=0.7.1
charset-normalizer>=1.3.6
Expand Down
Loading