AttributeError: ‘XXX’ object has no attribute ‘map’
Objects that meet the map format need to be in the form of key value pairs, so check whether the elements using the map function meet this condition.
For example:
#Create an object of DataFrame
list=[[1,1],[2,2]]
list=pd.DataFrame(list)
print(list)
#Use map to map them
for _, row in list.iterrows():
row[0]=row[0].map(lambda a:a+1)
Output:
correct method:
list=[[1,1],[2,2]]
list=pd.DataFrame(list)
print(list)
list[0]=list[0].map(lambda a:a+1)
print(list)
Output:
Read More:
- [Solved] AttributeError: ‘DataFrame‘ object has no attribute ‘tolist‘
- [Solved] AttributeError: DataFrame object has no attribute’xxx’
- How to Solve attributeerror: ‘list’ object has no attribute ‘shape‘
- AttributeError: DatetimeProperties object has no attribute
- [Solved] Networkx Error: Attributeerror: ‘graph’ object has no attribute ‘node’
- [Solved] AttributeError: ‘NoneType‘ object has no attribute ‘append‘
- [Solved] AttributeError: ‘PngImageFile‘ object has no attribute ‘imshow‘
- [Solved] AttributeError: ‘NoneType‘ object has no attribute ‘astype‘
- [Solved] AttributeError WriteOnlyWorksheet object has no attribute cell
- [Solved] AttributeError: ‘DataParallel‘ object has no attribute ‘save‘
- [Solved] vpython: AttributeError: ‘box‘ object has no attribute ‘idx‘
- [Solved] AttributeError: ‘str‘ object has no attribute ‘decode‘
- [Solved] Paramiko error: AttributeError: ‘NoneType’ object has no attribute ‘time’
- [Solved] AttributeError: ‘str‘ object has no attribute ‘decode‘
- [2021-10-05] Python Error: AttributeError: ‘NoneType‘ object has no attribute ‘append‘
- [Modified] AttributeError: ‘socket‘ object has no attribute ‘ioctl‘ python linux
- [Solved] pandas ExcelWrite AttributeError: ‘NoneType‘ object has no attribute ‘group‘
- [Solved] Pycharm error: attributeerror: ‘Htmlparser’ object has no attribute ‘unescape’
- [Solved] AttributeError: ‘HTMLWriter‘ object has no attribute ‘_temp_names‘
- [Solved] Pytorch Error: AttributeError: ‘Tensor‘ object has no attribute ‘backword‘