@@ -14,127 +14,124 @@ def concat(
1414 join : str = "outer" ,
1515 ignore_index : bool = False ,
1616):
17- """
18- Concatenate BigQuery DataFrames objects along a particular axis.
17+ """Concatenate BigQuery DataFrames objects along a particular axis.
1918
2019 Allows optional set logic along the other axes.
2120
2221 Can also add a layer of hierarchical indexing on the concatenation axis,
2322 which may be useful if the labels are the same (or overlapping) on
2423 the passed axis number.
2524
26- Parameters
27- ----------
28- objs:
29- Objects to concatenate. Any None objects will be dropped silently unless
30- they are all None in which case a ValueError will be raised.
31- axis : {0/'index', 1/'columns'}, default 0
32- The axis to concatenate along.
33- join: {'inner', 'outer'}, default 'outer'
34- How to handle indexes on other axis (or axes).
35- ignore_index : bool, default False
36- If True, do not use the index values along the concatenation axis. The
37- resulting axis will be labeled 0, ..., n - 1. This is useful if you are
38- concatenating objects where the concatenation axis does not have
39- meaningful indexing information. Note the index values on the other
40- axes are still respected in the join.
41-
42- Returns
43- -------
44- object, type of objs
45- When concatenating all ``Series`` along the index (axis=0), a
46- ``Series`` is returned. When ``objs`` contains at least one
47- ``DataFrame``, a ``DataFrame`` is returned.
48-
49- Notes
50- -----
51- It is not recommended to build DataFrames by adding single rows in a
52- for loop. Build a list of rows and make a DataFrame in a single concat.
53-
54- Examples
55- --------
25+ .. note::
26+ It is not recommended to build DataFrames by adding single rows in a
27+ for loop. Build a list of rows and make a DataFrame in a single concat.
28+
29+ **Examples:**
30+
31+ >>> import bigframes.pandas as pd
32+ >>> pd.options.display.progress_bar = None
33+
5634 Combine two ``Series``.
5735
58- >>> import bigframes.pandas as pd
59- >>> pd.options.display.progress_bar = None
60- >>> s1 = pd.Series(['a', 'b'])
61- >>> s2 = pd.Series(['c', 'd'])
62- >>> pd.concat([s1, s2])
63- 0 a
64- 1 b
65- 0 c
66- 1 d
67- dtype: string
36+ >>> s1 = pd.Series(['a', 'b'])
37+ >>> s2 = pd.Series(['c', 'd'])
38+ >>> pd.concat([s1, s2])
39+ 0 a
40+ 1 b
41+ 0 c
42+ 1 d
43+ dtype: string
6844
6945 Clear the existing index and reset it in the result
7046 by setting the ``ignore_index`` option to ``True``.
7147
72- >>> pd.concat([s1, s2], ignore_index=True)
73- 0 a
74- 1 b
75- 2 c
76- 3 d
77- dtype: string
48+ >>> pd.concat([s1, s2], ignore_index=True)
49+ 0 a
50+ 1 b
51+ 2 c
52+ 3 d
53+ dtype: string
7854
7955 Combine two ``DataFrame`` objects with identical columns.
8056
81- >>> df1 = pd.DataFrame([['a', 1], ['b', 2]],
82- ... columns=['letter', 'number'])
83- >>> df1
84- letter number
85- 0 a 1
86- 1 b 2
87- <BLANKLINE>
88- [2 rows x 2 columns]
89- >>> df2 = pd.DataFrame([['c', 3], ['d', 4]],
90- ... columns=['letter', 'number'])
91- >>> df2
92- letter number
93- 0 c 3
94- 1 d 4
95- <BLANKLINE>
96- [2 rows x 2 columns]
97- >>> pd.concat([df1, df2])
98- letter number
99- 0 a 1
100- 1 b 2
101- 0 c 3
102- 1 d 4
103- <BLANKLINE>
104- [4 rows x 2 columns]
57+ >>> df1 = pd.DataFrame([['a', 1], ['b', 2]],
58+ ... columns=['letter', 'number'])
59+ >>> df1
60+ letter number
61+ 0 a 1
62+ 1 b 2
63+ <BLANKLINE>
64+ [2 rows x 2 columns]
65+ >>> df2 = pd.DataFrame([['c', 3], ['d', 4]],
66+ ... columns=['letter', 'number'])
67+ >>> df2
68+ letter number
69+ 0 c 3
70+ 1 d 4
71+ <BLANKLINE>
72+ [2 rows x 2 columns]
73+ >>> pd.concat([df1, df2])
74+ letter number
75+ 0 a 1
76+ 1 b 2
77+ 0 c 3
78+ 1 d 4
79+ <BLANKLINE>
80+ [4 rows x 2 columns]
10581
10682 Combine ``DataFrame`` objects with overlapping columns
10783 and return everything. Columns outside the intersection will
10884 be filled with ``NaN`` values.
10985
110- >>> df3 = pd.DataFrame([['c', 3, 'cat'], ['d', 4, 'dog']],
111- ... columns=['letter', 'number', 'animal'])
112- >>> df3
113- letter number animal
114- 0 c 3 cat
115- 1 d 4 dog
116- <BLANKLINE>
117- [2 rows x 3 columns]
118- >>> pd.concat([df1, df3])
119- letter number animal
120- 0 a 1 <NA>
121- 1 b 2 <NA>
122- 0 c 3 cat
123- 1 d 4 dog
124- <BLANKLINE>
125- [4 rows x 3 columns]
86+ >>> df3 = pd.DataFrame([['c', 3, 'cat'], ['d', 4, 'dog']],
87+ ... columns=['letter', 'number', 'animal'])
88+ >>> df3
89+ letter number animal
90+ 0 c 3 cat
91+ 1 d 4 dog
92+ <BLANKLINE>
93+ [2 rows x 3 columns]
94+ >>> pd.concat([df1, df3])
95+ letter number animal
96+ 0 a 1 <NA>
97+ 1 b 2 <NA>
98+ 0 c 3 cat
99+ 1 d 4 dog
100+ <BLANKLINE>
101+ [4 rows x 3 columns]
126102
127103 Combine ``DataFrame`` objects with overlapping columns
128104 and return only those that are shared by passing ``inner`` to
129105 the ``join`` keyword argument.
130106
131- >>> pd.concat([df1, df3], join="inner")
132- letter number
133- 0 a 1
134- 1 b 2
135- 0 c 3
136- 1 d 4
137- <BLANKLINE>
138- [4 rows x 2 columns]
107+ >>> pd.concat([df1, df3], join="inner")
108+ letter number
109+ 0 a 1
110+ 1 b 2
111+ 0 c 3
112+ 1 d 4
113+ <BLANKLINE>
114+ [4 rows x 2 columns]
115+
116+ Args:
117+ objs (list of objects):
118+ Objects to concatenate. Any None objects will be dropped silently unless
119+ they are all None in which case a ValueError will be raised.
120+ axis ({0 or 'index', 1 or 'columns'}, default 0):
121+ The axis to concatenate along.
122+ join ({'inner', 'outer'}, default 'outer'):
123+ How to handle indexes on other axis (or axes).
124+ ignore_index (bool, default False):
125+ If True, do not use the index values along the concatenation axis. The
126+ resulting axis will be labeled 0, ..., n - 1. This is useful if you are
127+ concatenating objects where the concatenation axis does not have
128+ meaningful indexing information. Note the index values on the other
129+ axes are still respected in the join.
130+
131+ Returns:
132+ object, type of objs:
133+ When concatenating all ``Series`` along the index (axis=0), a
134+ ``Series`` is returned. When ``objs`` contains at least one
135+ ``DataFrame``, a ``DataFrame`` is returned.
139136 """
140137 raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
0 commit comments