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

ARIMA报错信息reduction operation ‘argmin‘ not allowed for this dtype 执行 from statsmodels.tsa.arima_model import ARIMA pmax = int(len(data)/10) #一般阶数不超过length/10 qmax = int(len(data)/10) #一般阶数不超过length/10 bic_matrix = [] #bic矩阵 for p in range(pmax+1): tmp = [] for q in range(qmax+1): try: #存在部分报错,所以用try来跳过报错。 阅读详情

报错分析


在这里插入图片描述
TypeError: reduction operation ‘argmax’ not allowed for this dtype(类型错误:此数据类型不允许还原操作“argmax”)

报错中显示的是数据类型的错误,因此我们需要知道我们的数据的类型有哪些:
在这里插入图片描述

解决过程

将为对象(object)的那一列修改类型即可
在这里插入图片描述

从永恒之蓝看内网安全:企业如何用Nmap+MSF快速检测445端口风险 本文探讨了企业如何利用Nmap和Metasploit快速检测445端口风险,防范永恒之蓝(MS17-010)漏洞攻击。通过分阶段检测流程和自动化工具组合,企业可高效识别内网风险主机,并实施紧急隔离与长效防护策略,提升整体网络安全防护能力。 阅读详情

相关推荐

SQL注入绕过information_schema:实战技法与替代路径详解

SQL注入是Web安全领域的核心漏洞类型,其原理是通过构造恶意SQL语句,干扰应用程序与数据库的正常交互逻辑,从而窃取或篡改数据。在渗透测试与CTF竞赛中,绕过常见防护措施是提升技术能力的关键。当标准的信息收集方式受阻时,例如无法访问information_schema数据库,攻击者需要掌握替代的元数据获取方法。这些技术价值在于模拟真实环境中日益严密的防御体系,锻炼在受限条件下的系统性信息收集思维。典型的应用场景包括存在WAF过滤、权限限制或编码干扰的实战环境。本文将围绕SQL注入这一核心,深入探讨如何利用

weixin_33980459的博客 433

TypeError: reduction operation 'argmax' not allowed for this dtype

程序报出"TypeError: reduction operation ‘argmax’ not allowed for this dtype"错误是说明数据类型不对和argmax方法已被弃用,改用idxmax 解决方式: 1,使用idxmax 2,检查数据类型是否是数值型如(integer, float).如果是object。则使用 .astype(数值型).idxmax() 如: result...

勿忘初心,方得始终 8326

ArcGIS基础:城市交通网络构建及设施服务分析(一):道路数据处理与拓扑操作

首先需要加载数据, 1:选择这个数据库:,右键导入,选择导入单个要素,弹出“要素类至要素类” 2:输出位置(导入的数据是CAD格式数据)。 3:输出要素类为道路。 4:字段只保留道路类型字段。 这个操作是分类合并各级道路数据。 1:通过属性选择各类道路数据。 2:比如此类都是“干道”。 3:编辑器下来,然后合并即可。 得到如图所示,需要用到三个字段。 上面这个操作是打断道路相交线。 1:选中所有数据。 2:找到高级编辑中的打断相交线。 3:确定即可。 下面进行拓扑检查,虽然我们已经进行合并和打断相交.

yuanYW7556的博客 2万+

reduction operation ‘argmax‘ not allowed for this dtype

使用python3时,将argmax()改为idxmax()仍然报错: reduction operation 'argmax' not allowed for this dtype 在idxmax前加.astype('float64'): .astype('float64').idxmax()

weixin_38594096的博客 820

【成功安装】Ubuntu22.04极简方式安装Nvidia驱动

今天下午安装了实机的Ubuntu,面临在Linux上安装Nvidia的问题,被这个问题困扰了一整个下午,各种报错整的我头大。后来发现了不需要按照传统的方式去Nvidia官网下载,再命令行安装,直接在线安装即可。

清筱明的博客 5349

Eplan P8自动线号生成全攻略:从电位定义点到连接编号的完整流程

本文详细解析了Eplan P8自动线号生成的全流程,从电位定义点的创建配置到连接编号的标准化管理,帮助电气设计人员提升图纸规范性和工作效率。重点介绍了自动编号方案的定义与调整技巧,以及企业级标准化实施建议,是掌握Eplan P8自动线号功能的实用指南。

weixin_29254029的博客 522

解决报错TypeError: reduction operation 'argmin' not allowed for this dtype

程序报错:raise TypeError(msg.format(name=f.name.replace(‘nan’, ‘’)))–TypeError: reduction operation ‘argmin’ not allowed for this dtype argmax方法已被弃用,改用idxmax 用print(df[‘columnName’].dtype)检查数据的类型,并确保它是数值...

muli 1万+

从时序迷宫到稳定通信:FSMC配置中的时间参数深度解析与实战避坑指南

本文深入解析STM32 FSMC配置中的时间参数,特别是AddressSetupTime和DataSetupTime的实战配置技巧。通过STM32F407连接SRAM的实际案例,提供从理论计算到CubeMX配置的全流程指南,帮助开发者避免常见时序陷阱,确保稳定通信。

nginx7reverse的博客 87

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

pandas 报错“TypeError: reduction operation 'argmax' not allowed for this dtype”解决办法问题现象问题原因解决办法 问题现象 执行语句crime.idxmax()报错,报错“TypeError: reduction operation ‘argmax’ not allowed for this dtype” 数据框crime: 问题原因 由打印数据框crime可知,列Year并非数据框crime的索引 idxmax() 返回的是最

qq_23904809的博客 1550

基于OpenMV与双舵机云台的激光追踪系统实战解析

本文详细解析了基于OpenMV摄像头与双舵机云台的激光追踪系统设计与实现。从硬件选型、图像识别算法到PID控制逻辑,全面介绍了如何构建一个高效稳定的激光追踪系统,并分享了电子设计竞赛中的实战经验与调试技巧。该系统在智能玩具、安防监控及教学演示等领域具有广泛应用前景。

prometheus9mon的博客 272

PCL RANSAC采样一致性算法

一直想了解一下RANSAC算法的一些原理,所以就趁着自己闲了下来整理了一下,做了这篇笔记。 文章目录一、简介二、PCL中的RANSAC 一、简介 RANSAC是一种随机参数估计算法。RANSAC从样本中随机抽选出一个样本子集,使用最小方差估计算法对这个子集计算模型参数,然后计算所有样本与该模型的偏差,再使用一个预先设定好的阈值与偏差比较,当偏差小于阈值时,该样本点属于模型内样本点(内点),否则就是外样本点(外点)。记录当前的内点的个数,然后重复上述的过程,直到模型中的内点达到最多,那么此时的模型参数即为最

dayuhaitang1的博客 2121

python中idxmax,出现TypeError:尝试使用idxmax()时,不允许对此dtype进行归约运算'argmax'...

When using the idxmax() function in Pandas, I keep receiving this error.Traceback (most recent call last):File "/Users/username/College/year-4/fyp-credit-card-fraud/code/main.py", line 20, in best_c_p...

weixin_35899665的博客 447

如何在 UniApp 中接入讯飞语音听写功能 文末附vue3+vue2完整代码

在开发过程中,我遇到了讯飞接口返回空数据的问题。通过仔细检查传送的每一帧数据,我发现问题出在第一帧的配置信息以及 Base64 数据的切片。确保每一帧的数据正确且符合接口要求,问题就能够得到解决。希望这个过程能帮助你在项目中顺利对接讯飞语音识别。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 1008

pytorch(黑马程序员)

深度学习简介:

2301_81873056的博客 255

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

TypeError: reduction operation ‘argmax‘ not allowed for this dtype

编写一个强化学习中的Q learning算法的代码,运行报错: 开头表示‘argmax’已经被丢弃,需要使用‘idxmax’代替,照做以后还是出现下面错误: 用idxmax函数去求series类型的最大值的索引,一行行测试都是一个满足idxmax函数要求的参数类型,都是标准的Series类型,且每个元素都是浮点数 最后发现是DataFram中的元素类型出现,我在其后添加.astype(‘float64’)运行就没有报错了!!! self.q_table = pd.DataFrame(columns=sel

weixin_43994864的博客 780

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

python中idxmax_出现TypeError:尝试使用idxmax()时,不允许对此dtype进行归约运算'argmax'...

When using the idxmax() function in Pandas, I keep receiving this error.Traceback (most recent call last):File "/Users/username/College/year-4/fyp-credit-card-fraud/code/main.py", line 20, in best_c_p...

weixin_39895167的博客 667

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

TypeError: reduction operation 'argmin' not allowed for this dtype

TypeError: reduction operation 'argmin' not allowed for this dtype使用pd.read_sql() 方法把Mysql的数据库转为dataframe后,使用 df['low'].idxmin() 或者df['low'].argmin() 方法是会出现这个错误。 date = date + '-01-01' cmd = '...

Aguangg_6655_la的博客 1万+

sklearn中TypeError: reduction operation argmax not allowed for this dtype idmax报错解决方案

sklearn中TypeError: reduction operation argmax not allowed for this dtype idmax报错解决方案 在网上学习的时候遇到了这个问题 造成如上报错的原因,可能是参数类型不支持,如对象是NAN时就会报错。 解决方法是对对象进行类型转换: best_c=results_table.loc[results_table[‘Mean recall score’].astype(float).idxmax()][‘C_parameter’] 将上述N

weixin_44013240的博客 546

python基础

Python基础知识学习 参考:链接: 阿里天池. # 这是一个注释 print("Hello world") Hello world ''' 这是多行注释,用三个单引号 这是多行注释,用三个单引号 这是多行注释,用三个单引号 ''' print("Hello china") """ 这是多行注释,用三个双引号 这是多行注释,用三个双引号 这是多行注释,用三个双引号 """ print("hello china") Hello china hello china print("hello p

weixin_43204668的博客 458

TypeError: reduction operation ‘argmin‘ not allowed for this dtype

改为bic_matrix.stack().astype(float).idxmin() #最小值的索引

qq_52698974的博客 2032

Java8函数式编程(3)--规约操作

规约操作(reduction operation)又被称作折叠操作(fold),是通过某个连接动作将所有元素汇总成一个汇总结果的过程。元素求和、求最大值或最小值、求出元素总个数、将所有元素转换成一个列表或集合,都属于规约操作。Stream类库有两个通用的规约操作reduce()和collect(),也有一些为简化书写而设计的专用规约操作,比如sum()、max()、min()、count()等。 ...

demon7552003的小本本 1565

解决方案:ValueError:DataFrame.dtypes for data must be int, float or bool

解决方案:ValueError:DataFrame.dtypes for data must be int, float or bool

weixin_42504788的博客 746
上一篇: 【Python数据分析 - 12】:Series结构、pandas中值的获取和修改、切片操作与排序(pandas篇)
下一篇: 【Python数据分析 - 13】:pandas的统计分析
街 三 仔
街 三 仔 新星创作者: python技术领域 新星创作者: python技术领域 领域专家: Python技术领域 领域专家: Python技术领域
博客等级 码龄5年 1万+粉丝 338原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

街 三 仔

你的鼓励是我创作的最大动力~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值