-1

Assume we have a dataframe with columns A, B, C. I would like to group by column A and then refer to the value of column A in the apply function.


            let groupby = df.groupby([col("A")]);
            let agg_expr = as_struct(&[col("B"), col("C")]).apply(move |s| {
                let ca = s.struct_()?;
                let s_B = &ca.fields()[0];
                let s_C = &ca.fields()[1];

                let ca_B = s_type.utf8()?;
                let ca_C = s_slot.utf8()?;
                
                // how to access the "A" column value here in the group??

              
                Ok(None)
            }, GetOutput::from_type(DataType::Utf8));
            let agg_plan = groupby.agg(&[agg_expr]);

kliao
  • 549
  • 1
  • 6
  • 14

0 Answers0