I'm trying to split the dataframe header id;signin_count;status into more columns where I can put my data into. I've tried df.columns.values, but I couldn't get a string to use .split in, as I was hoping. Instead, I got:
Index(['id;signin_count;status'], dtype='object')
Which returns AttributeError: 'Index' object has no attribute 'split' when I try .split
In broader terms, I have:
id;signin_count;status
0 353;20;done;
1 374;94;pending;
2 377;4;done;
And want:
id signin_count status
0 353 20 done
1 374 94 pending
2 377 4 done
Splitting the data itself is not the problem here, that I can do. The focus is on how to access the header names without hardcoding it, as I will have to do the same with any other dataset with the same format
From the get-go, thank you
df.columns[0].split(';').columnsrender a list of values, in your case, all you need is the first value.