Skip to content

Error when importing CSV #85

@thomasdixon86

Description

@thomasdixon86

I am trying to import a CSV file containing elevation data but am getting the following error: I have tried searching for this, but I am only getting Python solutions regarding defining an item. I am on the LTR, and the Plugin is up to date.

An error has occurred while executing Python code:

KeyError: 'Name'
Traceback (most recent call last):
File "C:\PROGRA1\QGIS331.10\apps\Python312\Lib\site-packages\pandas\core\indexes\base.py", line 3805, in get_loc
return self._engine.get_loc(casted_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas\_libs\hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Name'

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

Traceback (most recent call last):
File "C:\Users/tdixo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\Smart_Map.py", line 1697, in pushButton_ImportQGIS_clicked
self.list_index_outlier = functions.localizar_outlier(self.df, self.v_target)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/tdixo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\utils\functions.py", line 475, in localizar_outlier
z_mean = df[colname].mean() #media
~~^^^^^^^^^
File "C:\PROGRA1\QGIS331.10\apps\Python312\Lib\site-packages\pandas\core\frame.py", line 4102, in getitem
indexer = self.columns.get_loc(key)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\PROGRA1\QGIS331.10\apps\Python312\Lib\site-packages\pandas\core\indexes\base.py", line 3812, in get_loc
raise KeyError(key) from err
KeyError: 'Name'

Python version: 3.12.6 (main, Sep 7 2024, 18:59:42) [MSC v.1938 64 bit (AMD64)]
QGIS version: 3.34.10-Prizren Prizren, 113de9e1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions