Plotly Express:ValueError:' x'的值不是data_frame&#x27中的列的名称。
我在与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:
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此错误表明未正确识别数据框,以解决您在读取CSV时必须指定正确的定界符,
其余代码似乎正确。
This error indicate that DataFrame are not recognized correctly, to solve that you have to specify the correct delimiter when reading csv,
Rest of the code seems like correct.