### Assuming your dataframe is called df
df = pd.DataFrame.from_records([{
'CA1': 'A', 'CB1': 1.1, 'CA2': 'B', 'CB2': 1.2},
{'CA1': 'C', 'CB1': 1.3, 'CA2': 'D', 'CB2': 1.4},
{'CA1': 'E', 'CB1': 1.5, 'CA2': 'F', 'CB2': 1.6},
{'CA1': 'G', 'CB1': 1.7, 'CA2': 'H', 'CB2': 1.8}])
# Make new dataframe with extra columns and rename the headers to match
df2 = df[['CA2', 'CB2']].rename(columns={
'CA2': 'CA1', 'CB2': 'CB1'}
)
# Drop the extra columns from your initial dataframe
df.drop(columns=['CA2','CB2'], inplace=True)
# Concat the dataframes
# ignore index so your index continues naturally rather than resetting
df = pd.concat([df, df2], ignore_index=True)
### Sort your dataframe by CA1 first, then CB1
df.sort_values(by=['CA1', 'CB1'], inplace=True, ignore_index=True)
print(df)