草庐IT

infer_dtype

全部标签

python - DataFrame 中的字符串,但 dtype 是对象

为什么Pandas告诉我我有对象,尽管所选列中的每个项目都是一个字符串——即使在显式转换之后也是如此。这是我的数据框:Int64Index:56992entries,0to56991Datacolumns(total7columns):id56992non-nullvaluesattr156992non-nullvaluesattr256992non-nullvaluesattr356992non-nullvaluesattr456992non-nullvaluesattr556992non-nullvaluesattr656992non-nullvaluesdtypes:int64(

python - sklearn 错误 ValueError : Input contains NaN, 无穷大或对于 dtype ('float64' 的值太大)

我正在使用sklearn,但亲和力传播存在问题。我已经建立了一个输入矩阵,但我不断收到以下错误。ValueError:InputcontainsNaN,infinityoravaluetoolargefordtype('float64').我跑了np.isnan(mat.any())#andgetsFalsenp.isfinite(mat.all())#andgetsTrue我尝试过使用mat[np.isfinite(mat)==True]=0删除无限值,但这也不起作用。我可以做些什么来摆脱矩阵中的无限值,以便我可以使用亲和传播算法?我正在使用anaconda和python2.7.9。

python - sklearn 错误 ValueError : Input contains NaN, 无穷大或对于 dtype ('float64' 的值太大)

我正在使用sklearn,但亲和力传播存在问题。我已经建立了一个输入矩阵,但我不断收到以下错误。ValueError:InputcontainsNaN,infinityoravaluetoolargefordtype('float64').我跑了np.isnan(mat.any())#andgetsFalsenp.isfinite(mat.all())#andgetsTrue我尝试过使用mat[np.isfinite(mat)==True]=0删除无限值,但这也不起作用。我可以做些什么来摆脱矩阵中的无限值,以便我可以使用亲和传播算法?我正在使用anaconda和python2.7.9。

python - 如何检查python pandas中列的dtype

我需要使用不同的函数来处理数字列和字符串列。我现在做的真的很蠢:allc=list((agg.loc[:,(agg.dtypes==np.float64)|(agg.dtypes==np.int)]).columns)foryinallc:treat_numeric(agg[y])allc=list((agg.loc[:,(agg.dtypes!=np.float64)&(agg.dtypes!=np.int)]).columns)foryinallc:treat_str(agg[y])有没有更优雅的方法来做到这一点?例如foryinagg.columns:if(dtype(agg[y

python - 如何检查python pandas中列的dtype

我需要使用不同的函数来处理数字列和字符串列。我现在做的真的很蠢:allc=list((agg.loc[:,(agg.dtypes==np.float64)|(agg.dtypes==np.int)]).columns)foryinallc:treat_numeric(agg[y])allc=list((agg.loc[:,(agg.dtypes!=np.float64)&(agg.dtypes!=np.int)]).columns)foryinallc:treat_str(agg[y])有没有更优雅的方法来做到这一点?例如foryinagg.columns:if(dtype(agg[y

python - Pandas read_csv中的日期时间dtypes

我正在读取一个包含多个日期时间列的csv文件。我需要在读取文件时设置数据类型,但日期时间似乎是个问题。例如:headers=['col1','col2','col3','col4']dtypes=['datetime','datetime','str','float']pd.read_csv(file,sep='\t',header=None,names=headers,dtype=dtypes)运行时报错:TypeError:datatype"datetime"notunderstood事后通过pandas.to_datetime()转换列不是一个选项我不知道哪些列将是日期时间对象。

python - Pandas read_csv中的日期时间dtypes

我正在读取一个包含多个日期时间列的csv文件。我需要在读取文件时设置数据类型,但日期时间似乎是个问题。例如:headers=['col1','col2','col3','col4']dtypes=['datetime','datetime','str','float']pd.read_csv(file,sep='\t',header=None,names=headers,dtype=dtypes)运行时报错:TypeError:datatype"datetime"notunderstood事后通过pandas.to_datetime()转换列不是一个选项我不知道哪些列将是日期时间对象。

百度飞桨(PaddlePaddle) - PP-OCRv3 文字检测识别系统 Paddle Inference 模型推理

PaddleInference模型推理流程分别介绍文字检测、方向分类器和文字识别3个模型,基于PaddleInference的推理过程。使用whl包预测推理whl格式本质上是一个压缩包,里面包含了py文件,以及经过编译的pyd文件为了更加方便快速体验OCR文本检测与识别模型,PaddleOCR提供了基于PaddleInference预测引擎的whl包,方便您一键安装,体验PaddleOCR。安装whl包pipinstallpaddleocr-ihttps://pypi.tuna.tsinghua.edu.cn/simple--verbose使用whl包预测推理paddleocrwhl包会自动下

swift - 错误 : Generic parameter 'T' could not be inferred.

我在调用此方法时遇到问题:funcsetUpFeedbackForm(viewController:T,viewForScreenshot:UIView,completionHandler:@escaping()->())whereT:FeedbackFormDelegate{...}在这个包装函数中:publicclassfuncsetUpFeedbackFormWrapper(viewController:UIViewController,viewForScreenshot:UIView,completionHandler:@escaping()->()){setUpFeedbac

python - 将 dtype 从 int64 转换为 int32

基本上,我使用pythonx32位从文件加载一个包含多个numpy数组的列表对象(之前使用pythonx64保存在pickle中)。我可以正确加载它们并检查内容,但我无法使用它们。TypeError:Cannotcastarraydatafromdtype('int64')todtype('int32')如何将列表中的数组元素类型转换为int32,以便我可以将它们与pythonx32一起使用。当我尝试执行以下部分时出现错误:a=np.bincount(np.hstack(data['Y']))查看data['Y']里面的内容 最佳答案