python – how to merge duplicate row in one cell not combining other column

Asked By: Anonymous

enter image description here

there is option available of merging duplicate row they affect in other column also.
PFA in that merging duplicate column in one cell not affect other column
please answer me how do i using python

thank you in advance


Solution

Answered By: Anonymous

I think you should improve your question, but here is what I made out of it:

>>> my_data = {0: {'Date': 'Monday', 'Name': 'Lucy', 'Sale Price': 1371},
     ...:  1: {'Date': 'Monday', 'Name': 'Jone', 'Sale Price': 2269},
     ...:  2: {'Date': 'Monday', 'Name': 'Emily', 'Sale Price': 4337},
     ...:  3: {'Date': 'Tuesday', 'Name': 'Steven', 'Sale Price': 4755},
     ...:  4: {'Date': 'Tuesday', 'Name': 'Jone', 'Sale Price': 3493},
     ...:  5: {'Date': 'Tuesday', 'Name': 'Lucy', 'Sale Price': 4664},
     ...:  6: {'Date': 'Tuesday', 'Name': 'Emily', 'Sale Price': 2358},
     ...:  7: {'Date': 'Tuesday', 'Name': 'Ruby', 'Sale Price': 2337},
     ...:  8: {'Date': 'Wednesday', 'Name': 'Nicol', 'Sale Price': 1256},
     ...:  9: {'Date': 'Wednesday', 'Name': 'Steven', 'Sale Price': 4706},
     ...:  10: {'Date': 'Wednesday', 'Name': 'Jone', 'Sale Price': 3351}}


>>> df = pd.DataFrame.from_dict(my_data, orient='index')

>>> df
         Date    Name  Sale Price
0      Monday    Lucy        1371
1      Monday    Jone        2269
2      Monday   Emily        4337
3     Tuesday  Steven        4755
4     Tuesday    Jone        3493
5     Tuesday    Lucy        4664
6     Tuesday   Emily        2358
7     Tuesday    Ruby        2337
8   Wednesday   Nicol        1256
9   Wednesday  Steven        4706
10  Wednesday    Jone        3351

>>> df.groupby(['Date','Name']).sum()

                  Sale Price
Date      Name
Monday    Emily         4337
          Jone          2269
          Lucy          1371
Tuesday   Emily         2358
          Jone          3493
          Lucy          4664
          Ruby          2337
          Steven        4755
Wednesday Jone          3351
          Nicol         1256
          Steven        4706
techinplanet staff

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno