From 8d4d34779ed8d36e3af6fd8f4f12ee2ccaf8034a Mon Sep 17 00:00:00 2001 From: Amala Shwetah <93658002+Amala02@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:38:46 +0530 Subject: [PATCH] Update profile_report.py (#1515) --- src/ydata_profiling/profile_report.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ydata_profiling/profile_report.py b/src/ydata_profiling/profile_report.py index 48f2559f8..201ba471a 100644 --- a/src/ydata_profiling/profile_report.py +++ b/src/ydata_profiling/profile_report.py @@ -3,6 +3,11 @@ import warnings from pathlib import Path from typing import Any, Optional, Union +from PIL import Image +import warnings +with warnings.catch_warnings(): + warnings.simplefilter("ignore") + import pkg_resources try: from pyspark.sql import DataFrame as sDataFrame @@ -11,6 +16,7 @@ sDataFrame = TypeVar("sDataFrame") # type: ignore + from dataclasses import asdict, is_dataclass import numpy as np @@ -97,8 +103,11 @@ def __init__( type_schema: optional dict containing pairs of `column name`: `type` **kwargs: other arguments, for valid arguments, check the default configuration file. """ - self.__validate_inputs(df, minimal, tsmode, config_file, lazy) + + self.__validate_inputs(df, minimal, tsmode, config_file, lazy) + + if config_file or minimal: if not config_file: config_file = get_config("config_minimal.yaml") @@ -340,6 +349,13 @@ def to_file(self, output_file: Union[str, Path], silent: bool = True) -> None: output_file: The name or the path of the file to generate including the extension (.html, .json). silent: if False, opens the file in the default browser or download it in a Google Colab environment """ + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + pillow_version = pkg_resources.get_distribution("Pillow").version + version_tuple = tuple(map(int, pillow_version.split('.'))) + if version_tuple < (9, 5, 0): + warnings.warn("Try running command: 'pip install --upgrade Pillow' to avoid ValueError") + if not isinstance(output_file, Path): output_file = Path(str(output_file))