diff --git a/ChangeLog.md b/ChangeLog.md index 38fa81a..235e225 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -2,6 +2,7 @@ ## 2.0.1-dev (changes since 2.0.1 go here) + * Updated subsample function to be compatible with new version of pandas * A unified API for sourcetracking with Gibbs sampling, including leave-one-out cross-validation, has been created and is accessible as ``sourcetracker.gibbs``. diff --git a/sourcetracker/_sourcetracker.py b/sourcetracker/_sourcetracker.py index ed73ff3..894faee 100644 --- a/sourcetracker/_sourcetracker.py +++ b/sourcetracker/_sourcetracker.py @@ -231,8 +231,10 @@ def subsample_dataframe(df, depth, replace=False): pd.DataFrame Subsampled dataframe. ''' - f = partial(subsample_counts, n=depth, replace=replace) - return df.apply(f, axis=1, reduce=False, raw=False) + def subsample(x): + return pd.Series(subsample_counts(x.values, n=depth, replace=replace), + index=x.index) + return df.apply(subsample, axis=1) def generate_environment_assignments(n, num_sources):