Python ValueError:类型为';builtins.str';已收到';histnorm';直方图的性质

Python ValueError:类型为';builtins.str';已收到';histnorm';直方图的性质,python,machine-learning,histogram,Python,Machine Learning,Histogram,我得到了这个错误- 值错误: 为直方图的“histnorm”属性接收到类型为“builtins.str”的无效值 收到的值:“计数” 当我尝试运行此代码时- def plotHist(df,nameOfFeature): cls_train = df[nameOfFeature] data_array = cls_train hist_data = np.histogram(data_array) binsize = .5 trace1 = go.His

我得到了这个错误-

值错误: 为直方图的“histnorm”属性接收到类型为“builtins.str”的无效值 收到的值:“计数”

当我尝试运行此代码时-

def plotHist(df,nameOfFeature):
    cls_train = df[nameOfFeature]
    data_array = cls_train
    hist_data = np.histogram(data_array)
    binsize = .5

    trace1 = go.Histogram(
        x=data_array,
        histnorm='count',
        name='Histogram of Wind Speed',
        autobinx=False,
        xbins=dict(
            start=df[nameOfFeature].min()-1,
            end=df[nameOfFeature].max()+1,
            size=binsize
        )
    )

    trace_data = [trace1]
    layout = go.Layout(
        bargroupgap=0.3,
         title='The distribution of ' + nameOfFeature,
        xaxis=dict(
            title=nameOfFeature,
            titlefont=dict(
                family='Courier New, monospace',
                size=18,
                color='#7f7f7f'
            )
        ),
        yaxis=dict(
            title='Number of labels',
            titlefont=dict(
                family='Courier New, monospace',
                size=18,
                color='#7f7f7f'
            )
        )
    )
    fig = go.Figure(data=trace_data, layout=layout)
    py.iplot(fig)

plotHist(df,'Pregnancies')

错误的堆栈跟踪是什么?@Carcigenicate错误的堆栈跟踪是什么意思?应该有部分错误告诉您错误发生的确切位置。你在这里发布的内容只是错误的一部分。