I've got a dataframe that looks like this:
df = pd.DataFrame({
'Show': {0: 'ORIGINALS', 1: 'GINNY & GEORGIA', 2: 'VIKINGS', 3: 'MOVIE', 4: 'JACK RYAN', 5: 'ENCANTO'},
'Platform': {0: 'ORIGINALS', 1: 'NETFLIX', 2: 'NETFLIX', 3: 'MOVIE', 4: 'HBO', 5: 'DISNEY+'},
'Minutes': {0: 'ORIGINALS', 1: '2354', 2: '294', 3: 'MOVIE', 4: '199', 5: '100'},
'Week Ending': {0: '', 1: '1/15/2023', 2: '1/15/2023', 3: '', 4: '1/15/2023', 5: '1/15/2023'}})
df
I need it to look like this:
df = pd.DataFrame({
'Show': {0: 'GINNY & GEORGIA', 1: 'VIKINGS', 2: 'JACK RYAN', 3: 'ENCANTO'},
'Platform': {0: 'NETFLIX', 1: 'NETFLIX', 2: 'HBO', 3: 'DISNEY+'},
'Minutes': {0: '2354', 1: '294', 2: '199', 3: '100'},
'Week Ending': {0: '1/15/2023', 1: '1/15/2023', 2: '1/15/2023', 3: '1/15/2023'},
'Type': {0: 'ORIGINALS', 1: 'ORIGINALS', 2: 'MOVIE', 3: 'MOVIE'}})
df
In other words categorial stuff is occasionally in rows. I need to transfer that info to columns and delete the categorical rows.
Been wrestling with this for a while. Couldn't make any combo of loc, iloc or shift() work.