Open petrye opened 5 years ago
Hi, same problem:
[C:\Users\user64\Desktop\tmp\CSV>python csv2line.py -d emr -i "SmartGraph.~csv" -o import2.txt
[===========================================================]Read csv file 100%
Traceback (most recent call last): ]Processing 0%
File "C:\Users\user64\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\core\indexes\base.py", line 2895, 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 101, 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: 'brand'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\user64\Desktop\tmp\CSV\csv2line.py", line 100, in <module>
main(sys.argv[1:])
File "C:\Users\user64\Desktop\tmp\CSV\csv2line.py", line 30, in main
convert(dbname, inputfile, outputfile)
File "C:\Users\user64\Desktop\tmp\CSV\csv2line.py", line 73, in convert
+ ",brand=%s" % str(df_full["brand"][d]).replace(" ", "_") \
File "C:\Users\user64\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\core\frame.py", line 2906, in __getitem__
indexer = self.columns.get_loc(key)
File "C:\Users\user64\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\core\indexes\base.py", line 2897, in get_loc
raise KeyError(key) from err
KeyError: 'brand'
C:\Users\user64\Desktop\tmp\CSV>](url)
While compiling the code and reading the CSV File , an error called "KeyError:'brand'" has ocurred. What measurements can I take to fix this error?