ranaroussi / quantstats

Consider using f-strings PYL-C0209
Performance
Minor
6 occurrences in this check
Formatting a regular string which could be a f-string
1674        if figfmt == "svg":
1675            return figbytes.decode()
1676        data_uri = _b64encode(figbytes).decode()
1677        embed_string = '<img src="data:image/{};base64,{}" />'.format(figfmt, data_uri)1678    return embed_string
Formatting a regular string which could be a f-string
1667                return figbytes.decode()
1668            data_uri = _b64encode(figbytes).decode()
1669            embed_string.join(
1670                '<img src="data:image/{};base64,{}" />'.format(figfmt, data_uri)1671            )
1672    else:
1673        figbytes = figfiles.getvalue()
Formatting a regular string which could be a f-string
 823    if compounded:
 824        metrics["Cumulative Return %"] = (_stats.comp(df) * pct).map("{:,.2f}".format)
 825    else:
 826        metrics["Total Return %"] = (df.sum() * pct).map("{:,.2f}".format) 827
 828    metrics["CAGR﹪%"] = _stats.cagr(df, rf, compounded) * pct
 829
Formatting a regular string which could be a f-string
 821    metrics["~"] = blank
 822
 823    if compounded:
 824        metrics["Cumulative Return %"] = (_stats.comp(df) * pct).map("{:,.2f}".format) 825    else:
 826        metrics["Total Return %"] = (df.sum() * pct).map("{:,.2f}".format)
 827
Formatting a regular string which could be a f-string
 573            for ptf, dd_info in dd_info_dict.items():
 574                iDisplay(
 575                    iHTML(
 576                        '<h4 style="margin-bottom:20px">%s - Worst 5 Drawdowns</h4>' 577                        % ptf
 578                    )
 579                )
Formatting a regular string which could be a f-string
 142        for i in reversed(range(num_cols + 1, num_cols + 3)):
 143            str_td = "<td></td>" * i
 144            tpl = tpl.replace(
 145                f"<tr>{str_td}</tr>", '<tr><td colspan="{}"><hr></td></tr>'.format(i) 146            )
 147
 148    tpl = tpl.replace(