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+'<GO>,'Minutes': 0: 'ORIGINALS', 1: '2354', 2: '294', 3: 'MOVIE', 4: '199', 5: '100'<GO>,'Week Ending': 0: '', 1: '1/15/2023', 2: '1/15/2023', 3: '', 4: '1/15/2023', 5: '1/15/2023'<GO>})print(df)
I need it to look 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+'<GO>,'Minutes': 0: 'ORIGINALS', 1: '2354', 2: '294', 3: 'MOVIE', 4: '199', 5: '100'<GO>,'Week Ending': 0: '', 1: '1/15/2023', 2: '1/15/2023', 3: '', 4: '1/15/2023', 5: '1/15/2023'<GO>})print(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.