I have a situation,there are 3 columns(x,y,point) in my dataframe and I am copying id table from another df,but problem is that all columns have different values in them .I want to copy id column with point col such that point 1,2,3 have same id. df is
x y point
76.32 42.58 1
86.34 90.02 2
687.12 125.327 1
65.28 87.11 2
963.1 854.2 3
id colum from df1
M123
P478
Q145
J768
D476
expected output is
x y point id
76.32 42.58 1 M123
86.34 90.02 2 M123
687.12 125.327 1 P478
65.28 87.11 2 P478
963.1 854.2 3 P478
85.23 96.23 1 Q145
I am trying this code
df1["id"]= df["id"]
and output is
x y point id
76.32 42.58 1 M123
86.34 90.02 2 P478
687.12 125.327 1 Q145
65.28 87.11 2 j768
963.1 854.2 3 D476
85.23 96.23 1 P145
there are hundreds of rows in df so i cannot give row position. Is there any way to do it? any help will be appreciated