I have two tables -Source and Target,in Target I want to update values for one column randomly
pphanireddy007
Registered Posts: 3 ✭
I have two tables -Source and Target,in Target I want to update values for one column randomly from source table
Answers
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,226 Dataiker
Hi @pphanireddy007
,You can use a code recipe in this case:
import dataiku import pandas as pd, numpy as np from dataiku import pandasutils as pdu # Read recipe inputs dataset_1 = dataiku.Dataset("airline_stocks_prepared") df1 = dataset_1.get_dataframe() dataset_2 = dataiku.Dataset("airline_stocks") df2 = dataset_2.get_dataframe() np.random.seed(123) # for reproducibility df2['random_value'] = np.random.choice(df1['column_name'], size=len(df2)) # Write recipe outputs result = dataiku.Dataset("result") result.write_with_schema(df2)