This operation allows to potentially change the column type, so it must do extra allocations. Change it to:
g[:, :b] .-= mean_value
(which is in-place, and not replace) and things will be fast.
The g[!, :b] .-= mean_value version is needed if you wanted to de-mean column that holds Int.
The distinction between ! and : is a special feature of DataFrames.jl to allow to distinguish these two different (but similar) operations. ! is special for DataFrames.jl so it must be overridden. Standard dotview does not support ! at all.