I have two data frames in a list now I want to get null rows columns which are specified in another list. I tried to get but getting an error. Any suggestion about how to do it?
l1 = ['b','c'] df_list = [df1,df2] df1 = a b c_r c_c c_d d 0 0 q 1 0 0 3 1 0 NaN 0 0 0 1 2 0 Nan 0 1 0 4 3 0 d 0 0 0 5 4 0 Nan 0 0 1 6 df2 = a c d b_q b_d c_d 0 0 r 3 1 0 0 1 0 Nan 1 0 0 0 2 0 c 4 0 0 0 3 0 Nan 5 0 1 0 4 0 d 6 0 0 0
My code:
test_df=[] for df in df_list: for cn in l1: test_df.append(df[df[cn].isnull()])
1.4m articles
1.4m replys
5 comments
56.9k users