df = pd.DataFrame({'a': [1] * 10, 'b': [1, 2] * 5, 'c': list(range(10))})
df2 = pd.DataFrame({'e': [1, 1], 'd': [1, 2]})
orig = df.dtypes.to_dict()
orig.update(df2.dtypes.to_dict())
joined = df.join(df2, how='outer')
print(joined.dtypes)
joined.fillna(-1, inplace=True)
joined_orig_types = joined.apply(lambda x: x.astype(orig[x.name]))
print(joined_orig_types.dtypes)
Сохранить тип данных столбца Dataframe после внешнего слияния