How to Solve Show() error caused by empty data

In order to solve the show() error caused by empty data, it is used during filtering! x. Isnullat (1) determines whether it is empty. If it is empty, it will be discarded

 

//Filter .getDouble(1) 1 refers to the first column, starting from 0
    
    DF.filter(x => !x.isNullAt(1) && x.getDouble(1) < 1995).show(10)
    

Read More: