Home > other >  Pandas how apply the incoming table instead of column
Pandas how apply the incoming table instead of column

Time:04-23

 df_1st=df_go2. Groupby (' the consignee phone number) [' order time]. Apply (min). Reset_index () 
Df_1st. Rename (columns={' order time ':' first time '}, inplace=True)
Df_ods3=pd. The merge (df_go2 df_1st, left_on='consignee phone number, right_on=' consignee phone number, how='left')
Df_ods3. Loc [df_ods3 [' order time]==df_ods3 [' first time '], 'is the first single']='first'
Df_ods3. Loc [: 'if the first single']=df_ods3. Loc [: 'if the first single]. Fillna (' the first')


For constructing the first single this operation, for example, wants to be a def use the apply to call, but it can only be a column of a strategy, so complains keyerror without the column
  • Related