-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Request - Add optional keyword arguments to @unnest_wider
prefix (defaults to true). false removes the parent column prefix (except when a column name already exists in the Dataframe).
deep (defaults to false). true applies @unnest_wider to any sub NamedTuples, Dicts or Structs.
Example
struct X1
C::Int64
D::Int64
end
struct X2
A::X1
B::Int64
end
v = [ X2(X1(1,2),3), X2(X1(1,2),3) ]
df = DataFrame( v = [ X2(X1(1,2),3), X2(X1(1,2),3) ] )
@chain df begin # Currenty Functionality
@unnest_wider v
@unnest_wider v_A
end
@chain df begin # Proposal
@unnest_wider v deep=true prefix=false
#result DataFrame( C=[1,1], D=[2,2], B=[3,3] )
end
Request 2
applying @select to a Vector of identical Structs or a StructVector is equivalent to appling:
DataFrame
@unnest_wider deep=true prefix=false
selecting colums.
@chain v begin # Current
DataFrame
@unnest_wider A
end
@chain v begin # Proposal
@select C D B
#result DataFrame( C=[1,1], D=[2,2], B=[3,3] )
end
Request 3
Extend to KeyedArray
using AxisKeys
ka = KeyedArray( v, id = ["k1","k2"] )
@chain ka begin # Current
DataFrame
@unnest_wider value
@unnest_wider value_A
end
@chain ka begin # Proposal
@select id C D B
#result DataFrame( id=["k1","k2"], C=[1,1], D=[2,2], B=[3,3] )
end
Metadata
Metadata
Assignees
Labels
No labels