我有一个名为$ products的数组:
Traceback (most recent call last):
File "whatever.py", line 21, in <module>
df_redondeado = df.withColumn('columna_redondeada',round_column(df["Data"], df["Rounding"]))
File "whomever\spark\spark-2.3.1-bin-hadoop2.7\python\pyspark\sql\dataframe.py", line 1848, in withColumn
assert isinstance(col, Column), "col should be Column"
AssertionError: col should be Column
我想基于$ _GET [“ ID”]分配变量,例如$ title,$ price,$ Description等。即如果$ _GET [“ ID”]是外套,那么我想根据正确的产品规格分配变量。
我尝试过:
Array
(
[SpringJacket] => Array
(
[8] => Array
(
[OID] => 8
[Title] => Blossom Spring Jacket
[Description] => Random Description
[Option] => 8
[Price] => $289.99
)
[Coat] => Array
(
[M] => Array
(
[OID] => M
[Title] => Cordon Crombie Coat
[Description] => Description
[Option] => M
[Price] => $199.99
)
)
)
但它说:
$title = $products[$_GET["ID"]]["Title"];
$price = $products[$_GET["ID"]]["Price"];
$ID = $products[$_GET["ID"]]["ID"];
$description = $products[$_GET["ID"]]["Description"];
其他所有相同的行号都相同。
PS:第18行是
Notice: Undefined index: Title on line 18
答案 0 :(得分:0)
关于意外的$ options错误:
作为正确答案,您在$ options之前缺少分号。 更正后出现其他错误时,请更新您的问题,包括导致错误的代码或提出新问题。
关于未定义索引错误: 您的索引不正确。 您引用$ products [一个ID] [标题],而您的数组就像$ products [一个ID] [其他] [标题]