DavMelchi commited on
Commit
b333e60
·
1 Parent(s): 7723c9f

update TRX calculation to reset per BSC+BCF and count in btsId order

Browse files
Files changed (1) hide show
  1. queries/process_ciq_2g.py +3 -2
queries/process_ciq_2g.py CHANGED
@@ -627,9 +627,10 @@ def _build_trx_sheet_from_assigned_sites(
627
  ordered_cols.append(f"channel{i}Type")
628
 
629
  df_trx = df_trx.sort_values(
630
- by=["site", "btsId", "_sort_type", "_sort_maio"], kind="stable"
631
  )
632
- df_trx["TRX"] = range(1, len(df_trx) + 1)
 
633
  df_trx = df_trx[ordered_cols]
634
  return df_trx
635
 
 
627
  ordered_cols.append(f"channel{i}Type")
628
 
629
  df_trx = df_trx.sort_values(
630
+ by=["bscid", "bcfId", "btsId", "_sort_type", "_sort_maio"], kind="stable"
631
  )
632
+ # Reset TRX per BSC+BCF and count in btsId order.
633
+ df_trx["TRX"] = df_trx.groupby(["bscid", "bcfId"], sort=False).cumcount() + 1
634
  df_trx = df_trx[ordered_cols]
635
  return df_trx
636