Plotly Express:ValueError:' x'的值不是data_frame&#x27中的列的名称。

发布于 2025-02-08 05:14:02 字数 734 浏览 2 评论 0原文

我在与Plotly Express产生3D散点图时遇到了问题。

这是我的数据框架:

“

这是我的代码:

df = pd.read_csv('/Users/alissanicolet./Desktop/QGIS_Thesis/pythongraph.csv')
print(df)

fig = px.scatter_3d(
    data_frame=df,
    x='OSR',
    y='GSI',
    z='FSI',
    color="Samples",
    color_discrete_sequence=['magenta','green','blue'],
    template='ggplot2',
    title='Spacematrix of Sample Areas',
    hover_name='Samples',
    height=700,
    
)

pio.show(fig)

这是我的错误:

ValueError: Value of 'x' is not the name of a column in 'data_frame'. Expected one of ['Samples;FSI;GSI;OSR'] but received: OSR

这是半柱,是半柱问题?

I'm having a problem producing a 3d scatter plot with plotly express.

Here is my data frame:

df

Here is my code:

df = pd.read_csv('/Users/alissanicolet./Desktop/QGIS_Thesis/pythongraph.csv')
print(df)

fig = px.scatter_3d(
    data_frame=df,
    x='OSR',
    y='GSI',
    z='FSI',
    color="Samples",
    color_discrete_sequence=['magenta','green','blue'],
    template='ggplot2',
    title='Spacematrix of Sample Areas',
    hover_name='Samples',
    height=700,
    
)

pio.show(fig)

Here is my error:

ValueError: Value of 'x' is not the name of a column in 'data_frame'. Expected one of ['Samples;FSI;GSI;OSR'] but received: OSR

Is it the semi-colons that are the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

恏ㄋ傷疤忘ㄋ疼 2025-02-15 05:14:02

此错误表明未正确识别数据框,以解决您在读取CSV时必须指定正确的定界符,

df = pd.read_csv('/Users/alissanicolet./Desktop/QGIS_Thesis/pythongraph.csv', delimiter = ';')

其余代码似乎正确。

This error indicate that DataFrame are not recognized correctly, to solve that you have to specify the correct delimiter when reading csv,

df = pd.read_csv('/Users/alissanicolet./Desktop/QGIS_Thesis/pythongraph.csv', delimiter = ';')

Rest of the code seems like correct.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文