# Buggy code
def hist_viz(
    hist: Tuple[np.ndarray, np.ndarray],
    nrows: int,
    col: str,
    yscale: str,
    plot_width: int,
    plot_height: int,
    show_yticks: bool,
) -> Figure:
    """
    Render a histogram
    """
    # pylint: disable=too-many-arguments,too-many-locals
    counts, bins = hist
    intvls = _format_bin_intervals(bins)
    df = pd.DataFrame(
        {
            "intvl": intvls,
            "left": bins[:-1],
            "right": bins[1:],
            "freq": counts,
            "pct": counts / nrows * 100,
        }
    )

    tooltips = [("Bin", "@intvl"), ("Frequency", "@freq"), ("Percent", "@pct{0.2f}%")]
    fig = Figure(
        plot_width=plot_width,
        plot_height=plot_height,
        title=col,
        toolbar_location=None,
        tools="",
        y_axis_type=yscale,
    )
    bottom = 0 if yscale == "linear" or df.empty else df["freq"].min() / 2
    fig.quad(
        source=df,
        left="left",
        right="right",
        bottom=bottom,
        alpha=0.5,
        top="freq",
        fill_color="#6baed6",
    )
    hover = HoverTool(
        tooltips=tooltips,
        mode="vline",
    )
    fig.add_tools(hover)
    tweak_figure(fig, "hist", show_yticks)
    fig.yaxis.axis_label = "Frequency"
    if not df.empty:
        _format_axis(fig, df.iloc[0]["left"], df.iloc[-1]["right"], "x")
    if show_yticks:
        fig.xaxis.axis_label = col
        if yscale == "linear":
            _format_axis(fig, 0, df["freq"].max(), "y")

    return fig


# Traceback (ValueError)
nan_value = float("NaN")
df = pd.DataFrame(5 * [[1, nan_value]]
... )
df
0   1
0  1 NaN
1  1 NaN
2  1 NaN
3  1 NaN
4  1 NaN
rep = plot(df)
C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\numpy\lib\histograms.py:433: RuntimeWarning: invalid value encountered in greater
if np.any(bin_edges[:-1] > bin_edges[1:]):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\dataprep\eda\distribution\__init__.py", line 165, in plot
figure = render(intermediate, yscale=yscale, tile_size=tile_size)
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\dataprep\eda\distribution\render.py", line 1920, in render
visual_elem = render_distribution_grid(
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\dataprep\eda\distribution\render.py", line 1565, in render_distribution_grid
fig = hist_viz(data, nrows, col, yscale, plot_width, plot_height, False)
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\dataprep\eda\distribution\render.py", line 441, in hist_viz
fig = Figure(
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\bokeh\plotting\figure.py", line 155, in __init__
super().__init__(*arg, **kw)
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\bokeh\model.py", line 234, in __init__
super().__init__(**kwargs)
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\bokeh\core\has_props.py", line 247, in __init__
setattr(self, name, value)
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\bokeh\core\has_props.py", line 274, in __setattr__
super().__setattr__(name, value)
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\bokeh\core\property\descriptors.py", line 539, in __set__
self._internal_set(obj, value, setter=setter)
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\bokeh\core\property\descriptors.py", line 760, in _internal_set
value = self.property.prepare_value(obj, self.name, value)
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\bokeh\core\property\bases.py", line 331, in prepare_value
raise e
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\bokeh\core\property\bases.py", line 324, in prepare_value
self.validate(value)
File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\bokeh\core\property\instance.py", line 112, in validate
raise ValueError(msg)
ValueError: expected an instance of type Title, got 0 of type int

# Fixed code
def hist_viz(
    hist: Tuple[np.ndarray, np.ndarray],
    nrows: int,
    col: str,
    yscale: str,
    plot_width: int,
    plot_height: int,
    show_yticks: bool,
) -> Figure:
    """
    Render a histogram
    """
    # pylint: disable=too-many-arguments,too-many-locals
    counts, bins = hist
    if sum(counts) == 0:
        return _empty_figure(col, plot_height, plot_width)
    intvls = _format_bin_intervals(bins)
    df = pd.DataFrame(
        {
            "intvl": intvls,
            "left": bins[:-1],
            "right": bins[1:],
            "freq": counts,
            "pct": counts / nrows * 100,
        }
    )

    tooltips = [("Bin", "@intvl"), ("Frequency", "@freq"), ("Percent", "@pct{0.2f}%")]
    fig = Figure(
        plot_width=plot_width,
        plot_height=plot_height,
        title=col,
        toolbar_location=None,
        tools="",
        y_axis_type=yscale,
    )
    bottom = 0 if yscale == "linear" or df.empty else df["freq"].min() / 2
    fig.quad(
        source=df,
        left="left",
        right="right",
        bottom=bottom,
        alpha=0.5,
        top="freq",
        fill_color="#6baed6",
    )
    hover = HoverTool(
        tooltips=tooltips,
        mode="vline",
    )
    fig.add_tools(hover)
    tweak_figure(fig, "hist", show_yticks)
    fig.yaxis.axis_label = "Frequency"
    _format_axis(fig, df.iloc[0]["left"], df.iloc[-1]["right"], "x")
    if show_yticks:
        fig.xaxis.axis_label = col
        if yscale == "linear":
            _format_axis(fig, 0, df["freq"].max(), "y")

    return fig