Lincoln-Hannah
Lincoln-Hannah
I was thinking of the case of a unique index. I could convert the DataFrame to a dictionary of DataFrame rows: ``` df = DataFrame(name=["John", "Sally", "Kirk"], age=[23., 42., 59.],...
If this is for a unique index. Would it be better to return a DataFrameRow rather than a 1-row DataFrame. So replace `[1:1, :]` with `[1,:]` Then `d1["Sally].age` returns a...
That's a really nice syntax if its possible. With NamedArrays.jl you can do ``` df = DataFrame(name=["John", "Sally", "Kirk"], age=[23., 42., 59.], children=[3,5,2]) @chain df begin @aside age = NamedArray(...
Ok. `@transform :Age_relative_to_Sallly = :age .- age["Sally"]` suppose there are a few columns you would like to attach the index to. ``` @aside age = NamedArray( _.age, _.name ) @aside...
Something I just realised. DataFrame columns can be defined as NamedArrays, and cell values referenced within a `@transform` statement. A cell value can't be altered within a `@transform` block but...
Example - unstack multiple value columns (Please remove if not helpful) `DF = DataFrame( A=[1,2,2,3], B=[10,10,10,20], C=[missing,1,1,missing], D=['W','X','Y','Z'], E=['w','x','y','z'] )` `unstack( DF, :A, :B, [:C,:D,:E] ,allowduplicates=true)` should work like ```...
3- By overloading `getproperty`. Do you mean the ability to write Dict.key instead of Dict[:key] ? This is what [DotMaps.jl](https://github.com/mcmcgrath13/DotMaps.jl) does. It works for a `Dict` but not a `Dictionary`...
``` using WhereTraits, NamedTupleTools @traits Dictionary( x ) where isstructtype(typeof(x)) = Dictionary( ntfromstruct( x )) ``` Could do this
@bkamins Maybe a better way to think of it: 1. First change any line of the form `:ColumnName = ...` to `@rtransform ColumnName = ...`. 2. Then proceed as per...
Lines of the form `:columnName = ...` are changed to `@rtransform :columnName= ...` But not if they are within a sub-block (.e.g. `@by` or `@transform` ) ``` @chainWithrTransform begin DataFrame(A=1:4)...