ForwardSampling.topandas

ForwardSampling.topandas()

Convert the samples to pandas dataframe.

Returns:

The samples, one column per variable (named after it), one row per sample.

Return type:

pandas.DataFrame

Example

import pyagrum as gum
import pyagrum.clg as gclg

gum.initRandom(42)  # the draws of pyagrum.clg come from the random generator of aGrUM
clg = gclg.SEM.toclg("""
A = 2[1]
B = 1 + 0.5A[2]
C = 3 + B[1]
""")
fs = gclg.ForwardSampling(clg).makeSample(100)
df = fs.topandas()
list(df.columns)
# ['A', 'B', 'C']
len(df)
# 100

Class

ForwardSampling