我正在尝试在数据框中生成第 7 列:
arb_ser_num = 'zDfDD45'
predefined_number = 878
DATE Q1 Q2 Q3 Q4 Q5
0 2012-08-20 00:00:00 [Atlantic, Z, dEdd] None None None None
1 2012-08-21 00:00:00 [Pacific, Y, dEdd] None None None None
2 2012-08-22 00:00:00 [Indian, Y, dRdd] None None None None
3 2012-08-23 00:00:00 [Meditar, Z, dEdd] None None None None
4 2012-08-24 00:00:00 [Arctic, Z, dRdd] None None None None
df['Q6'] = df.apply(lambda row: get_q6(arb_ser_num, row, predefined_number), axis = 1)
有时 get_q6 会返回 [1,2,3,4,5],有时它会返回 [None]。我不断收到错误:
Shape of passed values is (5,), indices imply (5, 6)
我不知道如何解决它。我在这里找到了类似的东西,但我认为它不适用于我。我正在尝试跟踪海洋温度/洋流。