【发布时间】:2021-02-06 13:47:03
【问题描述】:
我一直对 jupyter notebook 中位置参数的限制有疑问。 我试图了解 100 次投掷中正面数量的变化,我们可以将结果收集在表格中并绘制直方图。
simulation_results = Table().with_column(
'Repetition', np.arange(1, num_repetitions + 1),
'Number of Heads', heads
)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-484d76c43683> in <module>
----> 1 simulation_results = Table().with_column(
2 'Repetition', np.arange(1, num_repetitions + 1),
3 'Number of Heads', heads
4 )
TypeError: with_column() takes from 3 to 4 positional arguments but 5 were given
【问题讨论】:
-
我不确定你的问题到底是什么。您的调用有错误数量的参数,这就是错误所说的。如果这是您混淆的根源,那么调用中还有另一个隐藏参数
self。请作为这里的新用户,使用tour 并阅读How to Ask。另外,尝试将有问题的代码简化为 minimal reproducible example 之类的内容,因为这里的人不知道你的上下文(而且猜测是不好的),而且它也让你更容易理解。 -
什么是
Table? -
@Tomerikoo: 表格来自datascience 包
-
@bvamos 你怎么知道?我在问题中没有看到任何线索......
-
@bvamos 我的意思是,您可能会认出,但其他人可能不会。我的评论更多的是针对 OP 而不是您。此类信息应edited 到问题中...