Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError while executing main.py #10

Open
SamanaBS opened this issue May 8, 2021 · 2 comments
Open

ValueError while executing main.py #10

SamanaBS opened this issue May 8, 2021 · 2 comments

Comments

@SamanaBS
Copy link

SamanaBS commented May 8, 2021

I tried executing this code on Google Colaboratory . The speech commands dataset got downloaded in drive and I got output when I executed main.py
But later when I again tried to execute main.py it is giving ValueError

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py", line 2889, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 97, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'category'

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

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pandas/core/generic.py", line 3565, in _set_item
loc = self._info_axis.get_loc(key)
File "/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py", line 2891, in get_loc
raise KeyError(key) from err
KeyError: 'category'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 19, in
main()
File "main.py", line 15, in main
marvin_model_test()
File "/content/gdrive/MyDrive/Colab Notebooks/Spoken-Keyword-Spotting/src/model_test.py", line 26, in marvin_model_test
testDF = getDataframe(dataDict["test"], include_unknown=True)
File "/content/gdrive/MyDrive/Colab Notebooks/Spoken-Keyword-Spotting/src/get_data.py", line 125, in getDataframe
df["category"] = df.apply(lambda row: inv_categories[row["labels"]], axis=1)
File "/usr/local/lib/python3.7/dist-packages/pandas/core/frame.py", line 3037, in setitem
self._set_item(key, value)
File "/usr/local/lib/python3.7/dist-packages/pandas/core/frame.py", line 3114, in _set_item
NDFrame._set_item(self, key, value)
File "/usr/local/lib/python3.7/dist-packages/pandas/core/generic.py", line 3568, in _set_item
self._mgr.insert(len(self._info_axis), key, value)
File "/usr/local/lib/python3.7/dist-packages/pandas/core/internals/managers.py", line 1159, in insert
block = make_block(values=value, ndim=self.ndim, placement=slice(loc, loc + 1))
File "/usr/local/lib/python3.7/dist-packages/pandas/core/internals/blocks.py", line 2717, in make_block
return klass(values, ndim=ndim, placement=placement)
File "/usr/local/lib/python3.7/dist-packages/pandas/core/internals/blocks.py", line 131, in init
f"Wrong number of items passed {len(self.values)}, "
ValueError: Wrong number of items passed 2, placement implies 1

This is the error I'm getting
Can you please help me with this

@vineeths96
Copy link
Owner

Works fine on my local machine. Maybe it's something Colab-specific?

@SamanaBS
Copy link
Author

SamanaBS commented May 8, 2021

Yeah I think so. Any idea how this error can be handled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants