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

got error: Error: No such keys(s): 'mode.use_inf_as_null' #401

Open
zjn-11 opened this issue Oct 12, 2023 · 0 comments
Open

got error: Error: No such keys(s): 'mode.use_inf_as_null' #401

zjn-11 opened this issue Oct 12, 2023 · 0 comments

Comments

@zjn-11
Copy link

zjn-11 commented Oct 12, 2023

Problem Description

alphalens.tears.create_full_tear_sheet(factor_data)
Cell In[20], line 1
----> 1 alphalens.tears.create_full_tear_sheet(factor_data)

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/alphalens/plotting.py:46, in customize.<locals>.call_w_context(*args, **kwargs)
     44     with plotting_context(), axes_style(), color_palette:
     45         sns.despine(left=True)
---> 46         return func(*args, **kwargs)
     47 else:
     48     return func(*args, **kwargs)

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/alphalens/tears.py:501, in create_full_tear_sheet(factor_data, long_short, group_neutral, by_group)
    497 plotting.plot_quantile_statistics_table(factor_data)
    498 create_returns_tear_sheet(
    499     factor_data, long_short, group_neutral, by_group, set_context=False
    500 )
--> 501 create_information_tear_sheet(
    502     factor_data, group_neutral, by_group, set_context=False
    503 )
    504 create_turnover_tear_sheet(factor_data, set_context=False)

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/alphalens/plotting.py:48, in customize.<locals>.call_w_context(*args, **kwargs)
     46         return func(*args, **kwargs)
     47 else:
---> 48     return func(*args, **kwargs)

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/alphalens/tears.py:365, in create_information_tear_sheet(factor_data, group_neutral, by_group)
    362 plotting.plot_ic_ts(ic, ax=ax_ic_ts)
    364 ax_ic_hqq = [gf.next_cell() for _ in range(fr_cols * 2)]
--> 365 plotting.plot_ic_hist(ic, ax=ax_ic_hqq[::2])
    366 plotting.plot_ic_qq(ic, ax=ax_ic_hqq[1::2])
    368 if not by_group:

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/alphalens/plotting.py:282, in plot_ic_hist(ic, ax)
    279     ax = ax.flatten()
    281 for a, (period_num, ic) in zip(ax, ic.items()):
--> 282     sns.histplot(ic.replace(np.nan, 0.0), kde=True, ax=a)
    283     a.set(title="%s Period IC" % period_num, xlabel="IC")
    284     a.set_xlim([-1, 1])

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/seaborn/distributions.py:1462, in histplot(data, x, y, hue, weights, stat, bins, binwidth, binrange, discrete, cumulative, common_bins, common_norm, multiple, element, fill, shrink, kde, kde_kws, line_kws, thresh, pthresh, pmax, cbar, cbar_ax, cbar_kws, palette, hue_order, hue_norm, color, log_scale, legend, ax, **kwargs)
   1451 estimate_kws = dict(
   1452     stat=stat,
   1453     bins=bins,
   (...)
   1457     cumulative=cumulative,
   1458 )
   1460 if p.univariate:
-> 1462     p.plot_univariate_histogram(
   1463         multiple=multiple,
   1464         element=element,
   1465         fill=fill,
   1466         shrink=shrink,
   1467         common_norm=common_norm,
   1468         common_bins=common_bins,
   1469         kde=kde,
   1470         kde_kws=kde_kws,
   1471         color=color,
   1472         legend=legend,
   1473         estimate_kws=estimate_kws,
   1474         line_kws=line_kws,
   1475         **kwargs,
   1476     )
   1478 else:
   1480     p.plot_bivariate_histogram(
   1481         common_bins=common_bins,
   1482         common_norm=common_norm,
   (...)
   1492         **kwargs,
   1493     )

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/seaborn/distributions.py:418, in _DistributionPlotter.plot_univariate_histogram(self, multiple, element, fill, common_norm, common_bins, shrink, kde, kde_kws, color, legend, line_kws, estimate_kws, **plot_kws)
    416     kde_kws["cumulative"] = estimate_kws["cumulative"]
    417     log_scale = self._log_scaled(self.data_variable)
--> 418     densities = self._compute_univariate_density(
    419         self.data_variable,
    420         common_norm,
    421         common_bins,
    422         kde_kws,
    423         log_scale,
    424         warn_singular=False,
    425     )
    427 # First pass through the data to compute the histograms
    428 for sub_vars, sub_data in self.iter_data("hue", from_comp_data=True):
    429 
    430     # Prepare the relevant data

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/seaborn/distributions.py:303, in _DistributionPlotter._compute_univariate_density(self, data_variable, common_norm, common_grid, estimate_kws, log_scale, warn_singular)
    299     common_norm = False
    301 densities = {}
--> 303 for sub_vars, sub_data in self.iter_data("hue", from_comp_data=True):
    304 
    305     # Extract the data points from this sub set and remove nulls
    306     sub_data = sub_data.dropna()
    307     observations = sub_data[data_variable]

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/seaborn/_core.py:983, in VectorPlotter.iter_data(self, grouping_vars, reverse, from_comp_data)
    978 grouping_vars = [
    979     var for var in grouping_vars if var in self.variables
    980 ]
    982 if from_comp_data:
--> 983     data = self.comp_data
    984 else:
    985     data = self.plot_data

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/seaborn/_core.py:1054, in VectorPlotter.comp_data(self)
   1050 axis = getattr(ax, f"{var}axis")
   1052 # Use the converter assigned to the axis to get a float representation
   1053 # of the data, passing np.nan or pd.NA through (pd.NA becomes np.nan)
-> 1054 with pd.option_context('mode.use_inf_as_null', True):
   1055     orig = self.plot_data[var].dropna()
   1056 comp_col = pd.Series(index=orig.index, dtype=float, name=var)

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/pandas/_config/config.py:441, in option_context.__enter__(self)
    440 def __enter__(self) -> None:
--> 441     self.undo = [(pat, _get_option(pat, silent=True)) for pat, val in self.ops]
    443     for pat, val in self.ops:
    444         _set_option(pat, val, silent=True)

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/pandas/_config/config.py:441, in <listcomp>(.0)
    440 def __enter__(self) -> None:
--> 441     self.undo = [(pat, _get_option(pat, silent=True)) for pat, val in self.ops]
    443     for pat, val in self.ops:
    444         _set_option(pat, val, silent=True)

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/pandas/_config/config.py:135, in _get_option(pat, silent)
    134 def _get_option(pat: str, silent: bool = False) -> Any:
--> 135     key = _get_single_key(pat, silent)
    137     # walk the nested dict
    138     root, k = _get_root(key)

File ~/opt/miniconda3/envs/vnpy/lib/python3.10/site-packages/pandas/_config/config.py:121, in _get_single_key(pat, silent)
    119     if not silent:
    120         _warn_if_deprecated(pat)
--> 121     raise OptionError(f"No such keys(s): {repr(pat)}")
    122 if len(keys) > 1:
    123     raise OptionError("Pattern matched multiple keys")

OptionError: No such keys(s): 'mode.use_inf_as_null'

Please provide any additional information below:

Versions

  • Alphalens version: 0.4.3
  • Python version: 3.10.10
  • Pandas version: 2.0.3
  • Matplotlib version: 3.5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant