本来想试着分析下数据,结果疯狂报错(晚上做梦都是这个该死的错误)
下面是出错的代码,其中data1是一个pandas里面的dataframe
pfr = ppf.ProfileReport(data1)
pfr.to_file("report.html")
w_median = (data[weights == np.max(weights)])[0]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
解决方案很简单,问题原因详见Potential incompatiblity with Pandas 1.4.0 · Issue #911 · ydataai/pandas-profiling · GitHub
我的解决方案是直接重装pandas,改成1.3.5的版本,就可以跑了。