How to keep columns based on a given row values

You want to use .loc[:, column_mask] i.e.

In [11]: df.loc[:, df.sum() > 0]
Out[11]:
       A  C
total  5  2

# or

In [12]: df.loc[:, df.iloc[0] > 0]
Out[12]:
       A  C
total  5  2

Use .where to set negative values to NaN and then dropna setting axis = 1:

df.where(df.gt(0)).dropna(axis=1)

       A  C
total  5  2

You can use, loc with boolean indexing or reindex:

df.loc[:, df.columns[(df.loc['total'] > 0)]]

OR

df.reindex(df.columns[(df.loc['total'] > 0)], axis=1)

Output:

       A  C
0.js   2  1
1.js   3  1
total  5  2