I have a faw data file and I need to split the column index 0 by comma. The dataset has no headers so I had to control index by number. After split, I will need to hash one of the column values before joining them back.
I using the code below to split.
Test = pd.concat([df,df[0].str.split(',',expand=True)],axis=1)
The column did split successfully but it appended the new columns after the last (which is 29 for my case) as 0,1,2,3,4, etc. Now I have repeated column numbers which I csnt rename properly. If I rename column 0 to 30, 2 columns will be rename.
I have tried using Test.reindex(axis=1) but nothing happens to the column index number.
How do indexed index column correctly?