Hello - I am trying to debug some code and wondering if anyone can help? I am running a Python script in PyCharm which basically takes a CSV file and performs some basic cleanup on a JSON. The file format hasn’t changed so the script should still work. When I run the code I get errors that I don’t know how to interpret, pasted below (removed any personal directory information and replaced with 'X’s). Anyone have any thoughts?
Traceback (most recent call last):
File “C:\Program Files\Python310\lib\site-packages\pandas\core\indexes\base.py”, line 3803, in get_loc
return self._engine.get_loc(casted_key)
File “pandas_libs\index.pyx”, line 138, in pandas._libs.index.IndexEngine.get_loc
File “pandas_libs\index.pyx”, line 165, in pandas._libs.index.IndexEngine.get_loc
File “pandas_libs\hashtable_class_helper.pxi”, line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item
File “pandas_libs\hashtable_class_helper.pxi”, line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: ‘JSON’
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “C:\Users\XXXXXXX\Documents\Work\XXXXXXXXX\XXXXXX.py”, line 73, in
for i in range(len(df[“JSON”])):
File “C:\Program Files\Python310\lib\site-packages\pandas\core\frame.py”, line 3805, in getitem
indexer = self.columns.get_loc(key)
File “C:\Program Files\Python310\lib\site-packages\pandas\core\indexes\base.py”, line 3805, in get_loc
raise KeyError(key) from err
KeyError: ‘JSON’