[英]Pandas returns error: 'Series' objects are mutable, thus they cannot be hashed
I have a problem here, I was trying to find a specific value in my data frame.我有一个问题,我试图在我的数据框中找到一个特定的值。 However I have received this error:
但是我收到了这个错误:
TypeError Traceback (most recent call last)
<ipython-input-245-ded282cec75c> in <module>
----> 1 data.iloc(data['Amount'] == '11,99')
~\Anaconda3\lib\site-packages\pandas\core\indexing.py in __call__(self, axis)
576
577 if axis is not None:
--> 578 axis = self.obj._get_axis_number(axis)
579 new_self.axis = axis
580 return new_self
~\Anaconda3\lib\site-packages\pandas\core\generic.py in _get_axis_number(cls, axis)
396 @classmethod
397 def _get_axis_number(cls, axis):
--> 398 axis = cls._AXIS_ALIASES.get(axis, axis)
399 if is_integer(axis):
400 if axis in cls._AXIS_NAMES:
~\Anaconda3\lib\site-packages\pandas\core\generic.py in __hash__(self)
1796
1797 def __hash__(self):
-> 1798 raise TypeError(
1799 f"{repr(type(self).__name__)} objects are mutable, "
1800 f"thus they cannot be hashed"
TypeError: 'Series' objects are mutable, thus they cannot be hashed
How can I proceed?我该如何进行?
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
data = pd.read_csv('Data.csv', sep = ';')
data.iloc(data['Amount'] == '11,99')
Use data[data['Amount'] == '11,99']
It should work just fine..!使用
data[data['Amount'] == '11,99']
它应该可以正常工作..!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.