Home > Software design >  ValueError: Maximum allowed size exceeded when plotting using seaborn
ValueError: Maximum allowed size exceeded when plotting using seaborn

Time:12-03

i have a data set with 37 columns and 230k rows

i am trying using seaborn to histogram every column

i have not yet cleaned my data

here is my code

for i in X.columns:
  plt.figure()
  ax = sns.histplot(data=df,x=i)

i got also this File C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\function_base.py:135 in linspace y = _nx.arange(0, num, dtype=dt).reshape((-1,) (1,) * ndim(delta))

any solution for this please

CodePudding user response:

It may be due to the size of your dataset. So you can try to draw one histogram at a time. I think there is a inconsistency in your code : you loop over the columns of the dataframe X but you draw the columns of the dataframe df. It is more consistent like that :

for i in df.columns:
  plt.figure()
  ax = sns.histplot(data=df,x=i)

CodePudding user response:

problem solved by determining the number of bins, since the bins default is set to auto and this was the reason, normally this leads to a huge computational error for high dataset size and with high variance the code solved my issue as below: for i in X.columns: plt.figure() ax = sns.histplot(data=df,x=i,bins=50)

  • Related