If the phone number and name are the same, I would like to put the shipping number at the back of the member number and send it to a new csv file.
Please give me some tips on what to do.
python csv list dictionary
You can use pd.merge.
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.merge.html
>>> import pandas as pd
>> a = pd.DataFrame ({"Name": ["Younghee", "Minsu"], "Phone Number": ["424", "114"], "Member Number": ["110", "104"]})
>> b = pd.DataFrame ({"Name":["Younghee", "Minsu"], "Phone Number":["424", "114"], "Shipping Number":["12341", "12355"]})
>>> a
Name Phone Number Member Number
0 Younghee 424 110
1 Minsu 114104
>>> b
Name Phone Number Shipping Number
0 Younghee 424 12341
1 Minsu 114 12355
>>> c = pd.merge(a,b,on=["Name", "Phone Number"])
>>> c
Name Phone Number Member Number Delivery Number
0 Younghee 424 110 12341
1 Minsu 114 104 12355
>>> print(c.to_markdown())
| | Name | Phone number | Member number | Shipping number |
|---:|:-------|-----------:|-----------:|-----------:|
| 0 | Younghee | 424 | 110 | 12341 |
| 1 | Minsu | 114 | 104 | 12355 |
579 Understanding How to Configure Google API Key
577 Who developed the "avformat-59.dll" that comes with FFmpeg?
626 Uncaught (inpromise) Error on Electron: An object could not be cloned
618 GDB gets version error when attempting to debug with the Presense SDK (IDE)
574 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.