AssertionError: 618 columns passed, passed data had 508 columns【Solved】

Problem Description

The program is interrupted and the error is as follows AssertionError: 618 columns passed, passed data had 508 columns

Exception has occurred: ValueError
618 columns passed, passed data had 508 columns
AssertionError: 618 columns passed, passed data had 508 columns

The above exception was the direct cause of the following exception:

  File "E:\matlab\CHB-MIT-DATA\epilepsy_eeg_classification\preprocessing.py", line 117, in eeg_preprocessing
    res = pd.DataFrame(res, columns=column_names)
  File "E:\matlab\CHB-MIT-DATA\epilepsy_eeg_classification\preprocessing.py", line 334, in <module>
    res = eeg_preprocessing(file, seizures)
ValueError: 618 columns passed, passed data had 508 columns

 The terminal reports an error as follows:

Backend Qt5Agg is interactive backend. Turning interactive mode on.

 

detour

numpy1.19.4 changed to numpy1.21.6

pip list: numpy1.21.6

conda list: numpy1.20.1

Found that the error is still the same, nothing has changed.

My suspicion is that there are nan values ​​in the data, and there is no way to deal with them in the program. Is it discarded as 0 or as the average value. Because if discarded.

I found that the numpy version is wrong. When uninstalling, it reported an error saying:

PackageNotInstalledError: Package is not installed in prefix

So I use

conda udate numpy

The error is as follows:

(base) PS E:\matlab> conda update numpy
Collecting package metadata (repodata.json): done
Solving environment: -
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - defaults/win-64::anaconda==custom=py37_1
  - https://repo.anaconda.com/pkgs/main/win-64::bkcharts==0.2=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::blaze==0.11.3=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::bokeh==0.13.0=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::dask==0.19.1=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::numpydoc==0.8.0=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::odo==0.5.1=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::seaborn==0.9.0=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::sphinx==1.7.9=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::spyder==3.3.1=py37_1
  - https://repo.anaconda.com/pkgs/main/win-64::statsmodels==0.9.0=py37h452e1ab_0
  - defaults/win-64::_anaconda_depends==5.3.1=py37_0
failed

CondaMemoryError: The conda process ran out of memory. Increase system memory and/or try again.

Some people say that you can directly return to the base environment to update conda.

(base) PS E:\matlab> conda update --name base conda
Collecting package metadata (repodata.json): done
Solving environment: |
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - defaults/win-64::anaconda==custom=py37_1
  - https://repo.anaconda.com/pkgs/main/win-64::bkcharts==0.2=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::blaze==0.11.3=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::bokeh==0.13.0=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::dask==0.19.1=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::numpydoc==0.8.0=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::odo==0.5.1=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::seaborn==0.9.0=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::sphinx==1.7.9=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::spyder==3.3.1=py37_1
  - https://repo.anaconda.com/pkgs/main/win-64::statsmodels==0.9.0=py37h452e1ab_0
  - defaults/win-64::_anaconda_depends==5.3.1=py37_0
failed

CondaMemoryError: The conda process ran out of memory. Increase system memory and/or try again.

conda update conda, conda update numpy, conda update --name base conda, both report errors in cat (self-built virtual environment) and base:

CondaMemoryError: The conda process ran out of memory. Increase system memory and/or try again.

Another friend suggested:

conda update conda -c conda-canary

But it still doesn't work, the error is as follows, which is the same as the previous error. 

CondaMemoryError: The conda process has insufficient memory answer - Programmer Sought

Updating the version of anaconda also reported the same error:

(base) PS E:\matlab> conda update anaconda
Collecting package metadata (repodata.json): done
Solving environment: \
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - defaults/win-64::anaconda==custom=py37_1
  - https://repo.anaconda.com/pkgs/main/win-64::bkcharts==0.2=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::blaze==0.11.3=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::bokeh==0.13.0=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::dask==0.19.1=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::numpydoc==0.8.0=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::odo==0.5.1=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::seaborn==0.9.0=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::sphinx==1.7.9=py37_0
  - https://repo.anaconda.com/pkgs/main/win-64::spyder==3.3.1=py37_1
  - https://repo.anaconda.com/pkgs/main/win-64::statsmodels==0.9.0=py37h452e1ab_0
  - defaults/win-64::_anaconda_depends==5.3.1=py37_0
failed

CondaMemoryError: The conda process ran out of memory. Increase system memory and/or try again.

After searching for a long time, I found a solution:

 https://github.com/conda/conda/issues/10751

solution

In the end it was commonplace and I checked the logic of the program. I found that in the process of passing parameters.

  File "E:\matlab\CHB-MIT-DATA\epilepsy_eeg_classification\preprocessing.py", line 117, in eeg_preprocessing
    res = pd.DataFrame(res, columns=column_names)
  File "E:\matlab\CHB-MIT-DATA\epilepsy_eeg_classification\preprocessing.py", line 334, in <module>

Although the error is reported at 117, in fact, at the two data points passed, through debugging, it is found that the number of columns of the obtained data is greater than the actual number of columns. That's because the channel of the signal changes, not 23 fixed, so you only need to change the fixed 23, and len(channel) can get the specific number.

Will

        for i in range(23):
            features.extend(eeg_features(temp[i]).tolist())

changed to

        for i in range(len(channels)):
            features.extend(eeg_features(temp[i]).tolist())

That's it.

It should be noted that the virtual environment created by conda should not be deleted indiscriminately, otherwise many errors will be reported. You can delete some corresponding files according to the content of the error report, but you cannot delete too many files. Otherwise, countless errors will be reported.

This can give you a huge headache. These three articles were all reported by me when I deleted the wrong file.

 You will find that you have unintentionally removed dependencies of some packages, which is troublesome.

In addition, the error reported by my program may be the same as yours, but the specific error is different. At this time, you have to check whether the data and column names you generated are in line with the situation. You can refer to this article to have a look, maybe it can solve your error:

Solved ValueError: 4 columns passed, passed data had 2 columns_Wuxianღ's Blog-CSDN Blog

reference article

Packagenotinstallederror: Not installed in prefix - Stack Overflow

Guess you like

Origin blog.csdn.net/a1456123a/article/details/128927429