Sort a table with irregular column info in Python

I have a messy table as per below, the data inside the table have integer and word/character. I want to sort the table from Info 5 to Info 1.

FruitInfo 1Info 2Info 3Info 4Info 5Appleqz2Grapew4Guavae7uKiwirnsm

Wish to get the result table as below.

FruitInfo 1Info 2Info 3Info 4Info 5KiwirnsmGuavae7uAppleqz2Grapew4

I have tried to use the str.contains, however it couldn't detect the integer.

i = ['Fruit', 'Info 1', 'Info 2', 'Info 3', 'Info 4', 'Info 5',] 

data[data[i].str.contains('', na=False)

python

dataframe

sorting

Sign In or Register to comment.