Define column-wise na/default value for merge operations. #1836
Labels
Dtype Conversions
Unexpected or buggy dtype conversions
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
I find myself often using fillna on a lot of columns after a merge operation and having to cast columns back to their original dtype.
Pseudo code now
data_types = df.dtypes
df_new = merge(df, df_other)
for col in former_int64_columns:
df_new[col] = df_new[col].fillna(0).astype(np.int64)
in some cases I may want a different default value, also for other column types than int64.
An idea would be something like a keyword argument "column_default_values = { 'a': 0, 'b': -1, ...}".
The text was updated successfully, but these errors were encountered: