MCPcopy Create free account
hub / github.com/ddf-project/DDF / sample2ddf

Method sample2ddf

python/ddf/dataframe.py:73–85  ·  view source on GitHub ↗

Get a sample of this DistributedDataFrame and return a new DistributedDataFrame :param fraction: fraction to take sample, has to be in the (0, 1] range :param replacement: sample with or without replacement :param seed: random seed :return: a new Distributed

(self, fraction, replacement=False, seed=123)

Source from the content-addressed store, hash-verified

71 return self._jddf.getViewHandler().getRandomSample(size, replacement, seed)
72
73 def sample2ddf(self, fraction, replacement=False, seed=123):
74 """
75 Get a sample of this DistributedDataFrame and return a new DistributedDataFrame
76
77 :param fraction: fraction to take sample, has to be in the (0, 1] range
78 :param replacement: sample with or without replacement
79 :param seed: random seed
80 :return: a new DistributedDataFrame
81 """
82 if fraction <= 0 or fraction > 1:
83 raise ValueError('fraction: expected a number in the (0, 1] range')
84
85 return DistributedDataFrame(self._jddf.getViewHandler().getRandomSample(fraction, replacement, seed))
86
87 def summary(self):
88 """

Callers

nothing calls this directly

Calls 3

getRandomSampleMethod · 0.65
getViewHandlerMethod · 0.45

Tested by

no test coverage detected