twinlab.join_samples#

twinlab.join_samples(df_one, df_two)[source]#

Join two dataframes that contain independent samples generated by the Emulator.sample() method.

The output from the Emulator.sample() method is a multi-indexed dataframe where the first level of the index is the parameter name and the second level is the sample number. This convenience method allows you to join two dataframes that contain independent samples generated by the Emulator.sample() method together into a single dataframe.

Parameters:
  • df_one (pd.DataFrame) – The first multi-indexed dataframe to join.

  • df_two (pd.DataFrame) – The second multi-indexed dataframe to join.

Returns:

The joined dataframe

Return type:

pd.DataFrame

Example

df_y1 = emulator.sample(df_X, 1) # Create first set of samples
df_y2 = emulator.sample(df_X, 3) # Creates new independent samples
tl.join_samples(df_y1, df_y2)
          y
          0         1         2         3
0  0.784193  1.308067  0.176582  0.875387
1  0.978259  1.039125  0.646922  0.887118
2  1.086855  0.942270  0.864730  0.934348