我正在尝试用每行中的第一个非空列值填充熊猫数据框第一列中的空值,并且似乎无法正常工作
这是一个例子
dfr = pd.DataFrame({'a':[np.nan, np.nan, 3, np.nan, np.nan], 'b':[4, np.nan, np.nan, 7, np.nan], 'c':[4, 5, 6, 7, np.nan], 'd':[3, 1, 3, 9, 12]})
#This is what my original data frame looks like
dfr
Out[107]:
a b c d
0 NaN 4.0 4.0 3
1 NaN NaN 5.0 1
2 3.0 NaN 6.0 3
3 NaN 7.0 7.0 9
4 NaN NaN NaN 12
#Here's what I would like the output to look like
dfr
Out[107]:
a b c d
0 4.0 4.0 4.0 3
1 5.0 NaN 5.0 1
2 3.0 NaN 6.0 3
3 7.0 7.0 7.0 9
4 12 NaN NaN 12
答案 0 :(得分:0)
检查orderByValue
console.log()