1
行
我有一個數據幀計數相同的值,如下:蟒蛇 - 熊貓:每
investing.com ft bloomberg
19 API Weekly Distillates Stocks NaN NaN
20 API Weekly Gasoline Stock NaN NaN
21 NaN Advance Goods Trade Balance Advance Goods Trade Balance
22 NaN NaN Advance Retail Sales
23 All Car Sales NaN NaN
24 All Truck Sales NaN NaN
25 Average Hourly Earnings MoM Average Hourly Earnings MoM Average Hourly Earnings MoM
26 NaN NaN Average Hourly Earnings YoY
我願與所有未楠值的計數添加一列。
我想:
df['count of not NaN'] = df.apply(lambda x:(x[['investing.com','ft','bloomberg']] != 'NaN').count(), axis=1)
,但沒有奏效。任何人都知道爲什麼/可以幫助我使用正確的配方? (我知道這個問題的一些口味已經發布,但他們不能真正幫助我獲得成功的結果......) 謝謝!
是的..對不起,愚蠢的問題..我正要刪除它,因爲我剛纔找到答案..反正。 –