-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Dtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode
Description
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, ...}".
Metadata
Metadata
Assignees
Labels
Dtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode