Python ValueError使用Pandas\u评测呈现html报告时出错
在为数据帧的子集运行概要文件报告时,我遇到以下错误Python ValueError使用Pandas\u评测呈现html报告时出错,python,pandas,pandas-profiling,Python,Pandas,Pandas Profiling,在为数据帧的子集运行概要文件报告时,我遇到以下错误 ValueError:值“6.180529706513958”应为1和0之间的比率。 这项工作: profile=ProfileReport( df,title=“一月转换数据集的概要报告” ) profile.to_文件(路径(“../../../products/jan_cvr_report.html”)) profile0=ProfileReport( df[df['conversion']==0],title=“一月转换的概要报告==
ValueError:值“6.180529706513958”应为1和0之间的比率。
这项工作:
profile=ProfileReport(
df,title=“一月转换数据集的概要报告”
)
profile.to_文件(路径(“../../../products/jan_cvr_report.html”))
profile0=ProfileReport(
df[df['conversion']==0],title=“一月转换的概要报告==0数据集”
)
profile0.to_文件(路径(“../../../products/jan_cvr0_report.html”))
这并不是:
profile1=ProfileReport(
df[df['conversion']==1],title=“一月转换的概要报告==1数据集”
)
profile1.to_文件(路径(“../../../products/jan_cvr1_report.html”))
我找到了一个建议我去工作的人。我的详细资料和堆栈跟踪都在那里
解决方案:
df1=df[df['conversion']=1]。复制(deep=True)
df1.user\u id.cat.remove\u unused\u类别(inplace=True)
运行上述操作后,概要文件报告工作正常。这些类极不平衡,因此当子集设置为conversion=1
时,大多数用户ID
都不会被使用。这也可以通过不将用户id
作为一个类别来解决。然而,这可能是其他类别的问题,所以我还是分享