-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: comparison to_json pd.Series encoding error (#1538)
* fix: comparison to_json pd.Series encoding error * fix(linting): code formatting * fix: unit test * fix(linting): code formatting --------- Co-authored-by: Azory YData Bot <[email protected]>
- Loading branch information
1 parent
cdfc17a
commit 2d9a24b
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
Test for issue 1529: | ||
https://github.com/ydataai/ydata-profiling/issues/1529 | ||
""" | ||
import json | ||
|
||
import pandas as pd | ||
|
||
from ydata_profiling import ProfileReport | ||
|
||
|
||
def test_issue1529(): | ||
previous_dataset = pd.DataFrame( | ||
data=[(1000, 42), (900, 30), (1500, 40), (1800, 38)], | ||
columns=["rent_per_month", "total_area"], | ||
) | ||
current_dataset = pd.DataFrame( | ||
data=[(5000, 350), (9000, 600), (5000, 400), (3500, 500), (6000, 600)], | ||
columns=["rent_per_month", "total_area"], | ||
) | ||
previous_dataset_report = ProfileReport( | ||
previous_dataset, title="Previous dataset report" | ||
) | ||
current_dataset_report = ProfileReport( | ||
current_dataset, title="Current dataset report" | ||
) | ||
comparison_report = previous_dataset_report.compare(current_dataset_report) | ||
json_str = comparison_report.to_json() | ||
compare_dict = json.loads(json_str) | ||
assert compare_dict is not None and len(compare_dict) > 0 | ||
assert ( | ||
compare_dict["analysis"]["title"] | ||
== "<em>Comparing</em> Previous dataset report <em>and</em> Current dataset report" | ||
) |