ranaroussi / quantstats

Consider removing the commented out code block PY-W0069
Anti-pattern
Major
17 occurrences in this check
Consider removing the commented out code block
 969
 970    metrics["Gain/Pain Ratio"] = _stats.gain_to_pain_ratio(df, rf)
 971    metrics["Gain/Pain (1M)"] = _stats.gain_to_pain_ratio(df, rf, "ME")
 972    # if mode.lower() == 'full': 973    #     metrics['GPR (3M)'] = _stats.gain_to_pain_ratio(df, rf, "Q")
 974    #     metrics['GPR (6M)'] = _stats.gain_to_pain_ratio(df, rf, "2Q")
 975    #     metrics['GPR (1Y)'] = _stats.gain_to_pain_ratio(df, rf, "A")
Consider removing the commented out code block
 856    if mode.lower() == "full":
 857        # metrics['Prob. Sortino Ratio %'] = _stats.probabilistic_sortino_ratio(df, rf, win_year, False) * pct
 858        metrics["Smart Sortino"] = _stats.smart_sortino(df, rf, win_year, True)
 859        # metrics['Prob. Smart Sortino Ratio %'] = _stats.probabilistic_sortino_ratio(df, rf, win_year, False, True) * pct 860
 861    metrics["Sortino/√2"] = metrics["Sortino"] / _sqrt(2)
 862    if mode.lower() == "full":
Consider removing the commented out code block
 854
 855    metrics["Sortino"] = _stats.sortino(df, rf, win_year, True)
 856    if mode.lower() == "full":
 857        # metrics['Prob. Sortino Ratio %'] = _stats.probabilistic_sortino_ratio(df, rf, win_year, False) * pct 858        metrics["Smart Sortino"] = _stats.smart_sortino(df, rf, win_year, True)
 859        # metrics['Prob. Smart Sortino Ratio %'] = _stats.probabilistic_sortino_ratio(df, rf, win_year, False, True) * pct
 860
Consider removing the commented out code block
 850    )
 851    if mode.lower() == "full":
 852        metrics["Smart Sharpe"] = _stats.smart_sharpe(df, rf, win_year, True)
 853        # metrics['Prob. Smart Sharpe Ratio %'] = _stats.probabilistic_sharpe_ratio(df, rf, win_year, False, True) * pct 854
 855    metrics["Sortino"] = _stats.sortino(df, rf, win_year, True)
 856    if mode.lower() == "full":
Consider removing the commented out code block
 820    if kwargs.get("as_pct", False):
 821        pct = 100
 822
 823    # return df 824    dd = _calc_dd(
 825        df,
 826        display=(display or "internal" in kwargs),
Consider removing the commented out code block
 761    else:
 762        blank = [""]
 763
 764    # if isinstance(returns, _pd.DataFrame): 765    #     if len(returns.columns) > 1:
 766    #         raise ValueError("`returns` needs to be a Pandas Series or one column DataFrame. multi colums DataFrame was passed")
 767    #     returns = returns[returns.columns[0]]
Consider removing the commented out code block
 992    colors = _FLATUI_COLORS
 993    if grayscale:
 994        colors = ["#f9f9f9", "#dddddd", "#bbbbbb", "#999999", "#808080"]
 995    # colors, ls, alpha = _get_colors(grayscale) 996
 997    port = _pd.DataFrame(returns.fillna(0))
 998    port.columns = ["Daily"]
Consider removing the commented out code block
 945        ax.yaxis.set_label_coords(-0.1, 0.5)
 946
 947    ax.yaxis.set_major_formatter(_FuncFormatter(format_pct_axis))
 948    # ax.yaxis.set_major_formatter(_plt.FuncFormatter( 949    #     lambda x, loc: "{:,}%".format(int(x*100))))
 950
 951    fig.autofmt_xdate()
Consider removing the commented out code block
 560    )
 561    ax.yaxis.set_label_coords(-0.1, 0.5)
 562
 563    # fig.autofmt_xdate() 564
 565    try:
 566        _plt.subplots_adjust(hspace=0, bottom=0, top=1)
Consider removing the commented out code block
 545            color="red",
 546        )
 547
 548    # _plt.setp(x.get_legend().get_texts(), fontsize=11) 549    ax.xaxis.set_major_formatter(
 550        _plt.FuncFormatter(lambda x, loc: "{:,}%".format(int(x * 100)))
 551    )
Consider removing the commented out code block
 521                .reset_index()
 522                .rename(columns={"level_1": "", 0: "Returns"})
 523            )
 524            # _sns.kdeplot(data=combined_returns, color='black', ax=ax) 525            x = _sns.histplot(
 526                data=combined_returns,
 527                x="Returns",
Consider removing the commented out code block
 411    savefig=None,
 412    show=True,
 413):
 414    # colors = ['#348dc1', '#003366', 'red'] 415    # if grayscale:
 416    #     colors = ['silver', 'gray', 'black']
 417
Consider removing the commented out code block
 355
 356    if percent:
 357        ax.yaxis.set_major_formatter(_FuncFormatter(format_pct_axis))
 358        # ax.yaxis.set_major_formatter(_plt.FuncFormatter( 359        #     lambda x, loc: "{:,}%".format(int(x*100))))
 360
 361    ax.set_xlabel("")
Consider removing the commented out code block
 348    ax.axhline(0, ls="-", lw=1, color="gray", zorder=1)
 349    ax.axhline(0, ls="--", lw=1, color="white" if grayscale else "black", zorder=2)
 350
 351    # if isinstance(benchmark, _pd.Series) or hline is not None: 352    ax.legend(fontsize=11)
 353
 354    _plt.yscale("symlog" if log_scale else "linear")
Consider removing the commented out code block
 320    if isinstance(returns, _pd.Series):
 321        ax.plot(returns, lw=lw, label=returns.name, color=colors[1], alpha=alpha)
 322    elif isinstance(returns, _pd.DataFrame):
 323        # color_dict = {col: colors[i+1] for i, col in enumerate(returns.columns)} 324        for i, col in enumerate(returns.columns):
 325            ax.plot(returns[col], lw=lw, label=col, alpha=alpha, color=colors[i + 1])
 326
Consider removing the commented out code block
 189
 190    ax.axhline(0, ls="--", lw=1, color="#000000", zorder=2)
 191
 192    # if isinstance(benchmark, _pd.Series) or hline: 193    ax.legend(fontsize=11)
 194
 195    _plt.yscale("symlog" if log_scale else "linear")
Consider removing the commented out code block
 169        ax.set_xticklabels(df.index)
 170        years = sorted(list(set(df.index)))
 171
 172    # ax.fmt_xdata = _mdates.DateFormatter('%Y-%m-%d') 173    # years = sorted(list(set(df.index.year)))
 174    if len(years) > 10:
 175        mod = int(len(years) / 10)