From 38f895b9324197553bfa709a9f4d7d250f8c4eda Mon Sep 17 00:00:00 2001 From: Ranuga <79456372+Programmer-RD-AI@users.noreply.github.com> Date: Wed, 22 May 2024 14:10:13 +0530 Subject: [PATCH] Add logging import and logger initialization in spark module This commit adds an import statement for the logging module and initializes a logger object in the spark module of FLAML. The logger is used to issue a warning message if pandas is not installed. This ensures that users are notified if they attempt to use DataFrame and Series functionalities without having pandas installed, providing them with guidance on resolving the issue. --- flaml/automl/spark/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flaml/automl/spark/__init__.py b/flaml/automl/spark/__init__.py index c8c8111f16..e348627a4b 100644 --- a/flaml/automl/spark/__init__.py +++ b/flaml/automl/spark/__init__.py @@ -11,6 +11,9 @@ from pyspark.pandas import set_option from pyspark.sql import DataFrame as sparkDataFrame from pyspark.util import VersionUtils + import logging + + logger = logging.getLogger(__name__) except ImportError: class psDataFrame: @@ -31,4 +34,5 @@ class psDataFrame: import pandas as pd from pandas import DataFrame, Series except ImportError: + logger.warning("Pandas is not installed. Please install pandas to use DataFrame and Series functionalities.") DataFrame = Series = pd = None