merrecdarkin / Wil-Project-AEMO-CSV-Efficient-Reading-Sorting-and-Export-

WIL
MIT License
1 stars 0 forks source link

App crashed after query #5

Closed larryhuangdev closed 2 years ago

larryhuangdev commented 2 years ago

Tested on:

Steps to reproduce:

[289 rows x 33 columns] .\Wil-Project-AEMO-CSV-Efficient-Reading-Sorting-and-Export-\read.py.old:24: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'. df2 = pd.read_csv(PathAndNameFile, skiprows=len(df. index)+2, skipfooter=1, on_bad_lines='skip') #This will fetch the BIDPEROFFER_D Traceback (most recent call last): File "%localappdata%\Programs\Python\Python310\lib\site-packages\pandas\core\indexes\base.py", line 3621, in get_loc return self._engine.get_loc(casted_key) File "pandas_libs\index.pyx", line 136, in pandas._libs.index.IndexEngine.get_loc File "pandas_libs\index.pyx", line 163, in pandas._libs.index.IndexEngine.get_loc File "pandas_libs\hashtable_class_helper.pxi", line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas_libs\hashtable_class_helper.pxi", line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'DUID'

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

Traceback (most recent call last): File ".\Wil-Project-AEMO-CSV-Efficient-Reading-Sorting-and-Export-\read.py.old", line 98, in
loadCSV(f,DUIDsets,folder) File ".\Wil-Project-AEMO-CSV-Efficient-Reading-Sorting-and-Export-\read.py.old", line 26, in loadCSV print(df2.loc[df2['DUID'] == targetDUID]) File "%localappdata%\Programs\Python\Python310\lib\site-packages\pandas\core\frame.py", line 3505, in getitem indexer = self.columns.get_loc(key) File "%localappdata%\Programs\Python\Python310\lib\site-packages\pandas\core\indexes\base.py", line 3623, in get_loc raise KeyError(key) from err KeyError: 'DUID'