Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: class exception #1584

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 src/ydata_profiling/model/description.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def duration(self) -> Union[timedelta, List[timedelta]]:
for i in range(len(self.date_start))
]
else:
raise ValueError()
raise TypeError()


@dataclass
Expand Down
3 changes: 2 additions & 1 deletion src/ydata_profiling/profile_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def __init__(
Args:
df: a pandas or spark.sql DataFrame
minimal: minimal mode is a default configuration with minimal computation
ts_mode: activates time-series analysis for all the numerical variables from the dataset. Only available for pd.DataFrame
ts_mode: activates time-series analysis for all the numerical variables from the dataset.
Only available for pd.DataFrame
sort_by: ignored if ts_mode=False. Order the dataset by a provided column.
sensitive: hides the values for categorical and text variables for report privacy
config_file: a config file (.yml), mutually exclusive with `minimal`
Expand Down
11 changes: 6 additions & 5 deletions src/ydata_profiling/utils/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Common util functions (e.g. missing in Python)."""
import contextlib

import collections.abc
import os
import platform
Expand Down Expand Up @@ -96,12 +98,12 @@ def convert_timestamp_to_datetime(timestamp: int) -> datetime:
else:
return datetime(1970, 1, 1) + timedelta(seconds=int(timestamp))


def analytics_features(dataframe, datatype: bool, report_type: bool):
def analytics_features(dataframe, datatype: str, report_type: str):
endpoint = "https://packages.ydata.ai/ydata-profiling?"

if os.getenv("YDATA_PROFILING_NO_ANALYTICS") != True:
package_version = __version__

try:
subprocess.check_output("nvidia-smi")
gpu_present = True
Expand All @@ -110,7 +112,7 @@ def analytics_features(dataframe, datatype: bool, report_type: bool):

python_version = ".".join(platform.python_version().split(".")[:2])

try:
with contextlib.suppress(Exception):
request_message = (
f"{endpoint}version={package_version}"
f"&python_version={python_version}"
Expand All @@ -122,5 +124,4 @@ def analytics_features(dataframe, datatype: bool, report_type: bool):
)

requests.get(request_message)
except Exception:
pass

7 changes: 0 additions & 7 deletions src/ydata_profiling/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@

from ydata_profiling.utils.common import analytics_features


class ProfilingLogger(logging.Logger):
def __init__(self, name, level=logging.INFO):
super().__init__(name, level)

def info(
self,
msg: object,
) -> None:
super().info(f"[PROFILING] - {msg}.")

def info_def_report(self, dataframe, timeseries: bool):
if dataframe == pd.DataFrame:
dataframe = "pandas"
Expand Down
Loading