Like the below R code, how can I simply generate the same data table in Python?
Genotype <- c(rep(c("CV1","CV2", "CV3"), each=9))
Treatment <- c(rep(c("TR1", "TR2", "TR3"), each=3), 
               rep(c("TR1", "TR2", "TR3"), each=3),
               rep(c("TR1", "TR2", "TR3"), each=3))
           
Block <- c(rep(c("B1","B2","B3"), times=9))
yield <- c(rep("15",5), rep("18",5), rep("20",8), rep("14",7), rep ("21",2))
dataA<- data.frame (Genotype, Treatment, Block, yield)
dataA
This is Python code I generated, but I believe more simple way. Could you let me know how to make a simple code, using rep() like in R?
import pandas
from pandas import DataFrame
        
source={'Genotype':["CV1","CV1","CV1","CV1","CV1","CV1","CV1","CV1","CV1","CV2","CV2",
                    "CV2","CV2","CV2","CV2","CV2","CV2","CV2","CV3","CV3","CV3","CV3",
                     "CV3","CV3", "CV3","CV3","CV3"],
'Treatment':["TR1","TR1","TR1","TR2","TR2","TR2","TR3","TR3","TR3","TR1","TR1","TR1","TR2","TR2",
             "TR2","TR3","TR3","TR3","TR1","TR1","TR1","TR2","TR2","TR2","TR3","TR3","TR3"],
'Block':["B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3",
         "B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3"],
'Yield':[15,15,15,15,15,18,18,18,18,18,20,20,20,20,20,20,20,20,14,14,14,14,14,14,14,21,21]}
        
DataA=DataFrame(source) 
    
DataA
Always thanks!!

 
    