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

Class DistributedDataFrame

python/ddf/dataframe.py:8–117  ·  view source on GitHub ↗

A Distributed Data Frame, the basic abstraction in DistributedDataFrame library.

Source from the content-addressed store, hash-verified

6
7
8class DistributedDataFrame(object):
9 """
10 A Distributed Data Frame, the basic abstraction in DistributedDataFrame library.
11 """
12
13 def __init__(self, jddf):
14 """
15 Constructor
16 """
17 self._jddf = jddf
18
19 ###########################################################################
20
21 @property
22 def colnames(self):
23 """
24 List the column names of this DDF
25
26 :return: a list of strings
27 """
28 return self._jddf.getColumnNames()
29
30 @property
31 def rows(self):
32 """
33 Get number of rows of this DDF
34
35 :return: an int
36 """
37 return int(self._jddf.getNumRows())
38
39 @property
40 def cols(self):
41 """
42 Get number of columns of this DDF
43
44 :return: an int
45 """
46 return int(self._jddf.getNumColumns())
47
48 ###########################################################################
49
50 def head(self, n=10):
51 """
52 Return this DistributedDataFrame's some first rows
53 """
54 return self._jddf.getViewHandler().head(n)
55
56 def project(self, column_names):
57 """
58 Project on some columns and return a new DistributedDataFrame
59 """
60 return DistributedDataFrame(self._jddf.getViewHandler().project(column_names))
61
62 def sample(self, size, replacement=False, seed=123):
63 """
64 Get a sample of this DistributedDataFrame and return a list of strings
65

Callers 4

sql2ddfMethod · 0.90
projectMethod · 0.85
sample2ddfMethod · 0.85
drop_naMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected