You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed the pivot_table method removes group_by columns and uses them as the index in the newly created DF. Is there a way to do the pivot table and keep the group_by columns in the resulting DF? This would ensure any columns dependent on the group_by columns maintain their source of data.
regards
The text was updated successfully, but these errors were encountered:
i come from the future to offer a solution to dem lost souls like me:
group_key=%i[abc]df=df.pivot_table(index: group_key,vectors: %i[x],agg: :sum,values: :value_col)metric_vectors=df.vectors.to_a.map{ |v| v.second.to_sym}# specific to my usecasedf.vectors=Daru::Index.new(metric_vectors)df.index.name=group_keydf.reset_index
Hi,
I noticed the pivot_table method removes group_by columns and uses them as the index in the newly created DF. Is there a way to do the pivot table and keep the group_by columns in the resulting DF? This would ensure any columns dependent on the group_by columns maintain their source of data.
regards
The text was updated successfully, but these errors were encountered: