pandas中报错:TypeError: reduction operation ‘argmax‘ not allowed for this dtype 的解决办法

简介: pandas中报错:TypeError: reduction operation ‘argmax‘ not allowed for this dtype 的解决办法

报错分析


6da6504929c8449da8d1619edfde6547.png

TypeError: reduction operation ‘argmax’ not allowed for this dtype(类型错误:此数据类型不允许还原操作“argmax”)


报错中显示的是数据类型的错误,因此我们需要知道我们的数据的类型有哪些:

9631197891ad4f14aeee092ffcae1ef9.png




解决过程


将为对象(object)的那一列修改类型即可

c17aa1b688cc4835a545c5fe3e9fdcc3.png


相关文章
|
3月前
|
Python
【Python】已解决:(pandas读取DataFrame列报错)raise KeyError(key) from err KeyError: (‘name‘, ‘age‘)
【Python】已解决:(pandas读取DataFrame列报错)raise KeyError(key) from err KeyError: (‘name‘, ‘age‘)
111 0
|
3月前
|
开发者 Python
【Python】已解决:(pandas read_excel 读取Excel报错)ImportError: Pandas requires version ‘2.0.1’ or newer of ‘x
【Python】已解决:(pandas read_excel 读取Excel报错)ImportError: Pandas requires version ‘2.0.1’ or newer of ‘x
116 0
|
12月前
|
编解码 Python
pandas - read_csv报错:‘utf-8‘/‘gbk‘ codec can‘t decode byte 0xb1 in position 0:invalid start byte
pandas - read_csv报错:‘utf-8‘/‘gbk‘ codec can‘t decode byte 0xb1 in position 0:invalid start byte
278 0
Pandas pd.merge() 报错:ValueError: You are trying to merge on int64 and object columns.
Pandas pd.merge() 报错:ValueError: You are trying to merge on int64 and object columns.
Pandas pd.merge() 报错:ValueError: You are trying to merge on int64 and object columns.
pandas读excel类型文件报错: xlrd.biffh.XLRDError: Excel xlsx file; not supported
pandas读excel类型文件报错: xlrd.biffh.XLRDError: Excel xlsx file; not supported
Pandas报错AttributeError: Cannot access callable attribute 'sort_values' of 'DataFrameGroupBy' objects
Pandas报错AttributeError: Cannot access callable attribute 'sort_values' of 'DataFrameGroupBy' objects
Pandas 报错 TypeError: ‘Series‘ objects are mutable, thus they cannot be hashed
Pandas 报错 TypeError: ‘Series‘ objects are mutable, thus they cannot be hashed
|
Python
Pandas报错no attribute 'convert_dtypes'解决办法
Pandas报错no attribute 'convert_dtypes'解决办法
270 0
|
Python
报错:import pandas._libs.parsers as parsers RuntimeWarning
报错:import pandas._libs.parsers as parsers RuntimeWarning
120 0
|
Python
pandas.read_csv() 报错 OSError: Initializing from file failed,报错原因分析和解决方法
pandas.read_csv() 报错 OSError: Initializing from file failed,报错原因分析和解决方法
625 0