if normal_cn:
normal_cn = normal_cn.autosomes(also=xy_names)
table = tumor_segs.data.loc[:, ["start", "end"]]
// Convert chromosome names to 1-based integer indices
chr2idx = {c: i+1
for i, c in enumerate(tumor_segs.chromosome.drop_duplicates())}
After Change
if normal_cn:
normal_cn = normal_cn.autosomes(also=xy_names)
table = tumor_segs.data.reindex(columns=["start", "end"])
// Convert chromosome names to 1-based integer indices
chr2idx = {c: i+1
for i, c in enumerate(tumor_segs.chromosome.drop_duplicates())}