-1
DataFrame A:

 Date        Code  Marks
 2020-01-01    X     5
 2020-01-02    Y     7
       ...


 DataFrame B:
 Date       Code Win Lose
 2020-01-01  X    8    1
 2020-01-02  Y    0    6

 The performance i needed:
 Date         Code  Marks Win Lose
 2020-01-01     X    5     8  1
 2020-01-02     Y    7     0  6

I want to combine dataframes with there name(code) how can I do this thx!

Czz
  • 1
  • 3

1 Answers1

0
A = pd.DataFrame(
    {
        "Date": ["2020-01-01", "2020-01-02",],
        "Code": ["X", "Y"],
        "Marks": ["5", "7"]
    },
)
B = pd.DataFrame(
    {
        "Date": ["2020-01-01", "2020-01-02",],
        "Code": ["X", "Y"],
        "Win": ["8", "0"],
        "Lose": ["1", "6"]

    },
)

result = pd.merge(A, B, on=["Code", "Date"])

Here's the answer to your question, I would advice looking up the doc if you need something : https://pandas.pydata.org/docs/user_guide/merging.html because it's very helpful...

grymlin
  • 492
  • 1
  • 9