Issue
I have read through articles of how to create fakedata but i dont understand how to create fake data from already existing data.
can someone please guide me how I can do this
Solution
I would suggest you to make a dictionary containing the 'correct'/'possible' values that UG
/PG
can have, like:
rolesdictug = {
'account manager': [list of ug valeus],
}
rolesdictpg = {
'account manager': [list of pg values]
}
and add other keys for other roles in the same manner. Then, use:
import numpy as np
fakedf = pd.DataFrame(columns = df.columns)
fakedf['Current Role'] = np.random.choice( [list of all roles], size= required_size )
fakedf['UG'] = fakedf['Current Role'].apply( lambda x: np.random.choice(rolesdictug[x]) )
fakedf['PG'] = fakedf['Current Role'].apply( lambda x: np.random.choice(rolesdictpg[x]) )
This should work!
Note: The keys of the two dictionaries must be the same as all roles
Answered By - pu239
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.