DEV Community

Nilotpal Choudhury
Nilotpal Choudhury

Posted on

Answer: create pandas dataframe with repeating values

I believe you need join lists by +:

df = pd.DataFrame({'AAA' : [4]*2 + [5]*2, 'BBB' : [10,20,30,40],'CCC' : [100,50,-30,-50]})
print (df)
   AAA  BBB  CCC
0    4   10  100
1    4   20   50
2    5   30  -30
3    5   40  -50

Or use repeat with concatenate:

df =

Top comments (0)