Skip to content

plot.histogram.max_bins setting error #1688

@shiyinhongsama

Description

@shiyinhongsama

Current Behaviour

when histogram bins > setting plot.histogram.max_bins

Exception:ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() in Python 3.10

The failed code is : ~/anaconda3/lib/python3.11/site-packages/ydata_profiling/model/summary_algorithms.py:44, in histogram_compute(config, finite_values, n_unique, name, weights)

Expected Behaviour

The report generate success.

Data Description

~/anaconda3/lib/python3.11/site-packages/ydata_profiling/model/summary_algorithms.py:44, in histogram_compute(config, finite_values, n_unique, name, weights)

Code that reproduces the bug

from ydata_profiling.config import Settings
from ydata_profiling.utils.paths import get_config
import numpy as np
import pandas as pd
from ydata_profiling import ProfileReport

data = [[1.0, 999,"", 10, None],
        [34.54,3424,None,4,5],
        [9548.43,1,"fdsfv",54,876],
        [32,43.43,"dsfda",43,12],
        [1.0,5454,"cxcc",13,43],
        [45.7,43,"fsdfsfsfdsfsdf",1,54],
        ]

df = pd.DataFrame(np.array(data), columns=["a", "b", "c", "d", "e"])

conf = get_config("config_default.yaml")
conf = Settings().from_file(conf)
conf.plot.histogram.max_bins=2
conf.plot.histogram.bins = 0
profile = ProfileReport(df, config=conf, title="Pandas Profiling Report")
# profile.to_widgets(
profile.to_file("./your_report.html")

pandas-profiling version

v4.12.0

Dependencies

*

OS

Macbook M1ship

Checklist

  • There is not yet another bug report for this issue in the issue tracker
  • The problem is reproducible from this bug report. This guide can help to craft a minimal bug report.
  • The issue has not been resolved by the entries listed under Common Issues.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions