Getting TypeError
while trying to import from ydata-profiling
. Reinstalling the module and reinstalling Python didn't solve the error.
from ydata_profiling import ProfileReport
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[1], line 6
4 import matplotlib.pyplot as plt
5 import scipy.stats as stats
----> 6 from ydata_profiling import ProfileReport
7 get_ipython().run_line_magic('matplotlib', 'inline')
8 import seaborn as sns
File ~\anaconda3\Lib\site-packages\ydata_profiling\__init__.py:14
10 warnings.simplefilter("ignore", category=NumbaDeprecationWarning)
12 import importlib.util # isort:skip # noqa
---> 14 from ydata_profiling.compare_reports import compare # isort:skip # noqa
15 from ydata_profiling.controller import pandas_decorator # isort:skip # noqa
16 from ydata_profiling.profile_report import ProfileReport # isort:skip # noqa
File ~\anaconda3\Lib\site-packages\ydata_profiling\compare_reports.py:12
10 from ydata_profiling.model import BaseDescription
11 from ydata_profiling.model.alerts import Alert
---> 12 from ydata_profiling.profile_report import ProfileReport
15 def _should_wrap(v1: Any, v2: Any) -> bool:
16 if isinstance(v1, (list, dict)):
File ~\anaconda3\Lib\site-packages\ydata_profiling\profile_report.py:53
48 from ydata_profiling.utils.paths import get_config
50 logger = ProfilingLogger(name="ReportLogger")
---> 53 @typechecked
54 class ProfileReport(SerializeReport, ExpectationsReport):
55 """Generate a profile report from a Dataset stored as a pandas `DataFrame`.
56
57 Used as is, it will output its content as an HTML report in a Jupyter notebook.
58 """
60 _description_set = None
File ~\anaconda3\Lib\site-packages\typeguard\_decorators.py:147, in typechecked(target)
145 for key, attr in target.__dict__.items():
146 if is_method_of(attr, target):
--> 147 retval = instrument(attr)
148 if isfunction(retval):
149 setattr(target, key, retval)
File ~\anaconda3\Lib\site-packages\typeguard\_decorators.py:75, in instrument(f)
72 else:
73 level += 1
---> 75 module_code = compile(module_ast, f.__code__.co_filename, "exec", dont_inherit=True)
76 new_code = module_code
77 for name in target_path:
TypeError: required field "ctx" missing from Subscript
My guess, given the traceback, was mismatched versions for either ydata_profiling or typeguard.
OP said it was typeguard and update fixed it.
For investigating that I had suggested originally that helped get to there:
I'm guessing you have mismatched versions for either ydata_profiling or typeguard; however, you don't provide details for either here? What does
%conda list
run inside the current notebook tell you for each of those? And how well do the release dates match so that you can determine which one needs updating?