I have dataframe with similar column names between 'A' and 'B' as below:
df = pd.DataFrame({'A_Text1':1, 'A_Text2':2, 'A_Text3':3, 'B_Text1':4, 'B_Text2':5, 'B_Text3':6, 'A_Text4':7, 'B_Text4':8})
When i use solution from here, Re-ordering columns in pandas dataframe based on column name I will get as such because it arrange alphabetically:
df = pd.DataFrame({'A_Text1':1, 'A_Text2':2, 'A_Text3':3, 'A_Text4':7, 'B_Text1':4, 'B_Text2':5, 'B_Text3':6, 'B_Text4':8})
What I truly need is to be able to arrange the column names by how I want to as below:
df = pd.DataFrame({'A_Text3':3, 'A_Text4':7, 'A_Text1':1, 'A_Text2':2, 'B_Text3':6, 'B_Text4':8, 'B_Text1':4, 'B_Text2':5})
Where the arrangement of column names with "_Text" is always like I specified above (_Text3, _Text4, _Text1, _Text2) because i have hundreds of columns with similar "_Text" name.