import pandas as pd df = pd.DataFrame([['?', 1], ['?', 3], ['?', 2], [3, '?']]) print(df) print(df.replace('?', 0))