So let's say I have a dataframe of this structure:
╔══════════════════════════════════════╦══════════════════╦════════════╦═══════════╦════════════════════╦══════════════╦══════════════════════╦═════════════════════╦═════════════════════════════════╦════════════════════════════════════════════╦════════════════════════════════════════════╗
║ candidate_id ║ public_id ║ first_name ║ last_name ║ email ║ phone_number ║ company_name ║ years_of_experience ║ normalized_degree ║ college_name ║ specialization_path ║
╠══════════════════════════════════════╬══════════════════╬════════════╬═══════════╬════════════════════╬══════════════╬══════════════════════╬═════════════════════╬═════════════════════════════════╬════════════════════════════════════════════╬════════════════════════════════════════════╣
║ a132a4f9-fa42-4802-8958-228952240d47 ║ divyanshu-thakur ║ Divyanshu ║ Thakur ║ [email protected] ║ xxxx ║ Google ║ 3 ║ Bachelor's / Undergraduate ║ Indian Institute of Information Technology ║ Technical / Quantitative~>Computer Science ║
╠══════════════════════════════════════╬══════════════════╬════════════╬═══════════╬════════════════════╬══════════════╬══════════════════════╬═════════════════════╬═════════════════════════════════╬════════════════════════════════════════════╬════════════════════════════════════════════╣
║ 71cfc6b7-b601-4ca0-b894-0b9f48dad717 ║ kami-kms ║ Kami ║ Kms ║ [email protected] ║ xxxxxxx ║ Groupon ║ 2 ║ High School Certificate/Diploma ║ Board of Education ║ Technical / Quantitative~>Statistics ║
╠══════════════════════════════════════╬══════════════════╬════════════╬═══════════╬════════════════════╬══════════════╬══════════════════════╬═════════════════════╬═════════════════════════════════╬════════════════════════════════════════════╬════════════════════════════════════════════╣
║ 71cfc6b7-b601-4ca0-b894-0b9f48dad717 ║ kami-kms ║ Kami ║ Kms ║ [email protected] ║ xxxxxxx ║ Groupon ║ 2 ║ Bachelor's / Undergraduate ║ ISBM University ║ Technical / Quantitative~>Statistics ║
╠══════════════════════════════════════╬══════════════════╬════════════╬═══════════╬════════════════════╬══════════════╬══════════════════════╬═════════════════════╬═════════════════════════════════╬════════════════════════════════════════════╬════════════════════════════════════════════╣
║ 8af6be9a-007e-4cfa-9965-aa65948e945f ║ kundan-mishra ║ KUNDAN ║ MISHRA ║ [email protected] ║ xxxxxxxx ║ Mobikwik ║ 8 ║ Master's / Graduate ║ IIM ║ Business / Commerce~>Marketing ║
╠══════════════════════════════════════╬══════════════════╬════════════╬═══════════╬════════════════════╬══════════════╬══════════════════════╬═════════════════════╬═════════════════════════════════╬════════════════════════════════════════════╬════════════════════════════════════════════╣
║ 8af6be9a-007e-4cfa-9965-aa65948e945f ║ kundan-mishra ║ KUNDAN ║ MISHRA ║ [email protected] ║ xxxxxxx ║ OYO - Vacation Homes ║ 8 ║ Master's / Graduate ║ IIM ║ Business / Commerce~>Marketing ║
╚══════════════════════════════════════╩══════════════════╩════════════╩═══════════╩════════════════════╩══════════════╩══════════════════════╩═════════════════════╩═════════════════════════════════╩════════════════════════════════════════════╩════════════════════════════════════════════╝
I want to groupby all elements using candidate_id
field.
So, what I want is:
╔══════════════════════════════════════╦══════════════════╦════════════╦═══════════╦════════════════════╦══════════════╦═══════════╦══════════════════════╦═════════════════════╦═════════════════════════════════╦════════════════════════════════════════════╦════════════════════════════════════════════╦════════════════════════════╦═════════════════╦══════════════════════════════════════╗
║ candidate_id ║ public_id ║ first_name ║ last_name ║ email ║ phone_number ║ company_1 ║ company_2 ║ years_of_experience ║ normalized_degree1 ║ college_name1 ║ specialization_path1 ║ normalized_degree2 ║ college_name2 ║ specialization_path2 ║
╠══════════════════════════════════════╬══════════════════╬════════════╬═══════════╬════════════════════╬══════════════╬═══════════╬══════════════════════╬═════════════════════╬═════════════════════════════════╬════════════════════════════════════════════╬════════════════════════════════════════════╬════════════════════════════╬═════════════════╬══════════════════════════════════════╣
║ a132a4f9-fa42-4802-8958-228952240d47 ║ divyanshu-thakur ║ Divyanshu ║ Thakur ║ [email protected] ║ xxxx ║ Google ║ NA ║ 3 ║ Bachelor's / Undergraduate ║ Indian Institute of Information Technology ║ Technical / Quantitative~>Computer Science ║ NA ║ NA ║ NA ║
╠══════════════════════════════════════╬══════════════════╬════════════╬═══════════╬════════════════════╬══════════════╬═══════════╬══════════════════════╬═════════════════════╬═════════════════════════════════╬════════════════════════════════════════════╬════════════════════════════════════════════╬════════════════════════════╬═════════════════╬══════════════════════════════════════╣
║ 71cfc6b7-b601-4ca0-b894-0b9f48dad717 ║ kami-kms ║ Kami ║ Kms ║ [email protected] ║ xxxxxxx ║ Groupon ║ NA ║ 2 ║ High School Certificate/Diploma ║ Board of Education ║ Technical / Quantitative~>Statistics ║ Bachelor's / Undergraduate ║ ISBM University ║ Technical / Quantitative~>Statistics ║
╠══════════════════════════════════════╬══════════════════╬════════════╬═══════════╬════════════════════╬══════════════╬═══════════╬══════════════════════╬═════════════════════╬═════════════════════════════════╬════════════════════════════════════════════╬════════════════════════════════════════════╬════════════════════════════╬═════════════════╬══════════════════════════════════════╣
║ 8af6be9a-007e-4cfa-9965-aa65948e945f ║ kundan-mishra ║ KUNDAN ║ MISHRA ║ [email protected] ║ xxxxxxxx ║ Mobikwik ║ OYO - Vacation Homes ║ 8 ║ Master's / Graduate ║ IIM ║ Business / Commerce~>Marketing ║ NA ║ NA ║ NA ║
╚══════════════════════════════════════╩══════════════════╩════════════╩═══════════╩════════════════════╩══════════════╩═══════════╩══════════════════════╩═════════════════════╩═════════════════════════════════╩════════════════════════════════════════════╩════════════════════════════════════════════╩════════════════════════════╩═════════════════╩══════════════════════════════════════╝
I am unable to find any way other than brute force to do this.