May-14-2022, 02:17 PM
(This post was last modified: May-15-2022, 11:26 AM by Yoriz.
Edit Reason: Added code tags
)
Hello,
When I run the csv file data I have with the following command, I get an error. I wonder if I got this from a ready-made command? What should I use to avoid errors?
When I run the csv file data I have with the following command, I get an error. I wonder if I got this from a ready-made command? What should I use to avoid errors?
plt.scatter(clusters_new['isci sayisi'],clusters_new['kazana'],c=clusters_new['kume_tahmin'],cmap='rainbow') plt.xlabel('Müşteri Çalışan Sayısı') plt.ylabel('Müşteri Ofis Kullanım Gün Sayısı')---------------------------------------------------------------------------
Error:KeyError Traceback (most recent call last)
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\indexes\base.py:3621, in Index.get_loc(self, key, method, tolerance)
3620 try:
-> 3621 return self._engine.get_loc(casted_key)
3622 except KeyError as err:
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\_libs\index.pyx:136, in pandas._libs.index.IndexEngine.get_loc()
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\_libs\index.pyx:163, in pandas._libs.index.IndexEngine.get_loc()
File pandas\_libs\hashtable_class_helper.pxi:5198, in pandas._libs.hashtable.PyObjectHashTable.get_item()
File pandas\_libs\hashtable_class_helper.pxi:5206, in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'kazana'
The above exception was the direct cause of the following exception:Error:KeyError Traceback (most recent call last)
Input In [83], in <cell line: 1>()
----> 1 plt.scatter(clusters_new['isci sayisi'],clusters_new['kazana'],c=clusters_new['kume_tahmin'],cmap='rainbow')
2 plt.xlabel('Müşteri Çalışan Sayısı')
3 plt.ylabel('Müşteri Ofis Kullanım Gün Sayısı')
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\frame.py:3505, in DataFrame.__getitem__(self, key)
3503 if self.columns.nlevels > 1:
3504 return self._getitem_multilevel(key)
-> 3505 indexer = self.columns.get_loc(key)
3506 if is_integer(indexer):
3507 indexer = [indexer]
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\indexes\base.py:3623, in Index.get_loc(self, key, method, tolerance)
3621 return self._engine.get_loc(casted_key)
3622 except KeyError as err:
-> 3623 raise KeyError(key) from err
3624 except TypeError:
3625 # If we have a listlike key, _check_indexing_error will raise
3626 # InvalidIndexError. Otherwise we fall through and re-raise
3627 # the TypeError.
3628 self._check_indexing_error(key)
KeyError: 'kazana'