Skip to content
Advertisement

Python pandas – can I sort 1 column dataset into rows of matching data in another dataset

I have half written a code and got stuck at 2nd half.

I have pulled info from a text doc and I have placed the info into pandas dataset column with data like

JavaScript

I have pulled all unique categories into another dataset and made them into columns

JavaScript

Now I want to cycle through the 1st dataset and fill out Each new job per row into the relevant columns, happy for the columns that don’t have data to be blank…

JavaScript

This is example. I actually have 33 unique categories.

I have no idea how to start coding this part (or if it’s possible). New to scripting so been happy to get this far..

I am using pandas as putting info into tables helps my brain because I am pulling info from a text doc and python likes to squash it all up but not sure if using pandas is limiting my options.

Any help /tips appreciated

Not sure if helps but my code so far

Advertisement

Answer

You can split data column by the first occurrence of ; into two columns, and group by the Job delimiter then transpose each group.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement