First column name with non null value by row pandas

前端 未结 3 2144
青春惊慌失措
青春惊慌失措 2021-01-03 08:59

I want know the first year with incoming revenue for various projects.

Given the following, dataframe:

ID  Y1      Y2      Y3
0   NaN     8       4
1         


        
3条回答
  •  走了就别回头了
    2021-01-03 09:28

    Apply this code to a dataframe with only one row to return the first column in the row that contains a null value.

    row.columns[~(row.loc[:].isna()).all()][-1]

提交回复
热议问题