【发布时间】:2020-07-28 12:11:25
【问题描述】:
我有示例架构,它包含 12 列,每列都有特定的类别。现在我需要将这些数据模拟成一个大约 1000 行的数据框。我该怎么办?
我使用下面的代码为每一列生成数据
Location = ['USA','India','Prague','Berlin','Dubai','Indonesia','Vienna']
Location = random.choice(Location)
Age = ['Under 18','Between 18 and 64','65 and older']
Age = random.choice(Age)
Gender = ['Female','Male','Other']
Gender = random.choice(Gender)
等等
我需要如下输出
Location Age Gender
Dubai below 18 Female
India 65 and older Male
。 . . .
【问题讨论】:
标签: python python-3.x pandas dataframe random