import pandas as pd merged = pd.DataFrame({\'Z\':(0,1.,2.5,3.),\'X\':(-1.,None,None,0),\'U\':(0,1.,1.,0)}) for col in merged: merged[col] = pd.to_numeric(merged