0

I have a data change history table. It is a form in which various ids, values, and creation time are stamped, but I want to convert it to the following form.

as-is table

user_id admin_id school major phone number created_at updated_at
111 123 abc school computer science 123456789 2021-07-28 2021-07-29
111 123 abc school bio information 123456789 2021-08-18 2021-08-18

to-be table

user_id admin_id school major phone number created_at updated_at user_id admin_id school major phone number created_at updated_at
111 123 abc school computer science 123456789 2021-07-28 2021-07-29 111 123 abc school bio information 123456789 2021-08-18 2021-08-18

How can I do it using python and pandas?

lucy
  • 1
  • Please make sure you have do research before post any question. You can see at first table have duplicates data except last colomn,so read https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.drop_duplicates.html. I see the next table you want to add column to your dataframe, so look at https://stackoverflow.com/questions/12555323/how-to-add-a-new-column-to-an-existing-dataframe. – Wahyu Hadinoto Jan 05 '22 at 04:36

0 Answers0