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 […]
how to sum a groupby in pandas with repeating data, while preserving other columns
I have a data source that looks approximately like this:
Using groupby as_index=False, count, to_frame gives ‘Dataframe’ object has no attribute to_frame
I am trying to create a new dataframe from an existing dataframe with a groupby(), a count(), and a to_frame(). I am getting AttributeError: ‘DataFrame’ object has no attribute ‘to_frame’ after adding ‘as_index=False’ to the groupby.