小编Jee*_*van的帖子

如何在anaconda spyder中更改python版本

我在mac上的anaconda spyder中使用3.6 Python版本.但我想将其更改为Python 2.7.

谁能告诉我怎么做?

python spyder anaconda

23
推荐指数
5
解决办法
9万
查看次数

包含 pyspark SQL:类型错误:“列”对象不可调用

我正在使用火花 2.0.1,

 df.show()
+--------+------+---+-----+-----+----+
|Survived|Pclass|Sex|SibSp|Parch|Fare|
+--------+------+---+-----+-----+----+
|     0.0|   3.0|1.0|  1.0|  0.0| 7.3|
|     1.0|   1.0|0.0|  1.0|  0.0|71.3|
|     1.0|   3.0|0.0|  0.0|  0.0| 7.9|
|     1.0|   1.0|0.0|  1.0|  0.0|53.1|
|     0.0|   3.0|1.0|  0.0|  0.0| 8.1|
|     0.0|   3.0|1.0|  0.0|  0.0| 8.5|
|     0.0|   1.0|1.0|  0.0|  0.0|51.9|
Run Code Online (Sandbox Code Playgroud)

我有一个数据框,我想使用 withColumn 向 df 添加一个新列,新列的值基于其他列值。我使用了这样的东西:

>>> dfnew = df.withColumn('AddCol' , when(df.Pclass.contains('3.0'),'three').otherwise('notthree'))
Run Code Online (Sandbox Code Playgroud)

它给出了一个错误

TypeError: 'Column' object is not callable
Run Code Online (Sandbox Code Playgroud)

可以帮助如何克服这个错误。

python apache-spark apache-spark-sql pyspark

5
推荐指数
1
解决办法
3万
查看次数