Registered users can ask their own questions, contribute to discussions, and be part of the Community!
How can I count number of non-null columns in a row.
Similar to CountA[D1:D5] in excel.
Thanks in advance
df as your dataframe.
df.apply(lambda x: x.count(), axis=1)
Or better still assign the count to another variable.
df['non_null_count'] = df.apply(lambda x: x.count(), axis=1)