SyntaxError:行继续符后的意外字符(反斜杠)

问题描述 投票:0回答:1

我正在尝试从指南中运行以下代码,但我不知道为什么会出现此错误。阅读此类错误会强调问题出在哪里(反斜杠),但我不确定如何解决此问题。

x_range = [dataset['RM'].min(),dataset['RM'].max()]
y_range = [dataset['target'].min(),dataset['target'].max()]
scatter_plot = dataset.plot(kind='scatter', x='RM', y='target', \xlim=x_range, ylim=y_range)
meanY = scatter_plot.plot(x_range, [dataset['target'].mean(),\  dataset['target'].mean()], '--' , color='red', linewidth=1)
meanX = scatter_plot.plot([dataset['RM'].mean(),\dataset['RM'].mean()], y_range, '--', color='red', linewidth=1)

[Code and Error]

python syntax
1个回答
1
投票

\xlim更改为xlim

即更改:

scatter_plot = dataset.plot(kind='scatter', x='RM', y='target', \xlim=x_range, ylim=y_range)

收件人:

scatter_plot = dataset.plot(kind='scatter', x='RM', y='target', xlim=x_range, ylim=y_range)
© www.soinside.com 2019 - 2024. All rights reserved.