Update code to use latest DataFrames API