df.append() with dicts converts booleans to 1s and 0s df.append() with dicts converts booleans to 1s and 0s pandas pandas

df.append() with dicts converts booleans to 1s and 0s


You can convert your dict to a DataFrame before appending to keep the data types consistent:

df = pd.DataFrame()df.append(pd.DataFrame({'A': True, 'B': False}, index = [0]))     A      B0   True    False