Skip to content

Commit 8d4d347

Browse files
authored
Update profile_report.py (#1515)
1 parent 2bc13d9 commit 8d4d347

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/ydata_profiling/profile_report.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
import warnings
44
from pathlib import Path
55
from typing import Any, Optional, Union
6+
from PIL import Image
7+
import warnings
8+
with warnings.catch_warnings():
9+
warnings.simplefilter("ignore")
10+
import pkg_resources
611

712
try:
813
from pyspark.sql import DataFrame as sDataFrame
@@ -11,6 +16,7 @@
1116

1217
sDataFrame = TypeVar("sDataFrame") # type: ignore
1318

19+
1420
from dataclasses import asdict, is_dataclass
1521

1622
import numpy as np
@@ -97,8 +103,11 @@ def __init__(
97103
type_schema: optional dict containing pairs of `column name`: `type`
98104
**kwargs: other arguments, for valid arguments, check the default configuration file.
99105
"""
100-
self.__validate_inputs(df, minimal, tsmode, config_file, lazy)
106+
101107

108+
self.__validate_inputs(df, minimal, tsmode, config_file, lazy)
109+
110+
102111
if config_file or minimal:
103112
if not config_file:
104113
config_file = get_config("config_minimal.yaml")
@@ -340,6 +349,13 @@ def to_file(self, output_file: Union[str, Path], silent: bool = True) -> None:
340349
output_file: The name or the path of the file to generate including the extension (.html, .json).
341350
silent: if False, opens the file in the default browser or download it in a Google Colab environment
342351
"""
352+
with warnings.catch_warnings():
353+
warnings.simplefilter("ignore")
354+
pillow_version = pkg_resources.get_distribution("Pillow").version
355+
version_tuple = tuple(map(int, pillow_version.split('.')))
356+
if version_tuple < (9, 5, 0):
357+
warnings.warn("Try running command: 'pip install --upgrade Pillow' to avoid ValueError")
358+
343359
if not isinstance(output_file, Path):
344360
output_file = Path(str(output_file))
345361

0 commit comments

Comments
 (0)