I have some coloums that contain floats. Now for analysis I want to use the measurement datatype, because it also gives me uncertainties. I tried this, but it doesβt work, because I want the values to be written back into the same spot. How can I do something like this?:
You canβt, the poing of .= is tp reuse existing memory to save allocations, but different data types have different memory layouts so the memory can be reused.
Yes, that makes sense. This gives me back the dataframe with the coloums that where floats now converted to measurements. But I would somehow need to write it back to the original dataframe, because it remains unchanged.
Or even renamecols = false instead of .=> names(df, Float64). But again select will create a copy here. select! will work, but drop other columns. If you want to use the minilanguage you want transform!:
In [29]: transform!(df, names(df, Int) .=> float; renamecols = false)
2Γ3 DataFrame
Row β x y z
β Float64 Float64 Float64
ββββββΌβββββββββββββββββββββββββββββ
1 β 1.0 0.0932927 1.0
2 β 2.0 0.112173 2.0