Relative Content

Tag Archive for pythonpandasdataframegroup-by

Create multiple columns from a single column and group by pandas

work = pd.DataFrame({“JOB” : [‘JOB01’, ‘JOB01’, ‘JOB02’, ‘JOB02’, ‘JOB03’, ‘JOB03’], “STATUS” : [‘ON_ORDER’, ‘ACTIVE’,’TO_BE_ALLOCATED’, ‘ON_ORDER’, ‘ACTIVE’,’TO_BE_ALLOCATED’], “PART” : [‘PART01’, ‘PART02′,’PART03′,’PART04′,’PART05′,’PART06’]}) How can I use Pandas to groupby the JOB, split Status into columns based on the values and concatenate the Part field based on the JOB. Desired Output: JOB | ON_ORDER | ACTIVE | TO_BE_ALLOCATED […]