mercredi 15 avril 2020

How to create a dataframe with simulated data in python

I have sample schema, which consists 12 columns, and each column has certain category. Now i need to simulate those data into a dataframe of around 1000 rows. How do i go about it?

I have used below code to generate data for each column

      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)

and so on

I need the output as below

       Location        Age          Gender
       Dubai           below 18     Female
       India           65 and older Male

. . . .




Aucun commentaire:

Enregistrer un commentaire