I have a data combination question.

Asked 1 years ago, Updated 1 years ago, 68 views

About big data

in a data frame

A

11

12

13

13

14

11

15 When it's like this, add item B next to A.

A B

11 a

12 b

13 cu

13 cu

14 r

11 a

15 m

I want to put it up like this. It's hard to put it in one by one because it's a lot. Is there a way to check two numbers in item A and create item B to display the letters that fit the number in item A?

bigdata python

2022-09-21 10:05

1 Answers

import pandas as pd
df = pd.DataFrame ({'A': [11, 12, 13, 14, 15], 'B': ['',', '',', '',', '',']})
data = pd.DataFrame({'A':[11, 12, 13, 13, 14, 11]})
data = data.merge(df)
print(data)


2022-09-21 10:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.