Skip to content

Commit 497ca24

Browse files
committed
Fix from_dataframe docstring
Signed-off-by: Vasily Litvinov <fam1ly.n4me@yandex.ru>
1 parent 60379e5 commit 497ca24

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

pandas/core/exchange/from_dataframe.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@
3333

3434

3535
def from_dataframe(df, allow_copy=True):
36+
"""
37+
Build a ``pd.DataFrame`` from any DataFrame supporting the interchange protocol.
38+
39+
Parameters
40+
----------
41+
df : DataFrameXchg
42+
Object supporting the exchange protocol, i.e. `__dataframe__` method.
43+
allow_copy : bool, default: True
44+
Whether to allow copying the memory to perform the conversion
45+
(if false then zero-copy approach is requested).
46+
47+
Returns
48+
-------
49+
pd.DataFrame
50+
"""
3651
if isinstance(df, pd.DataFrame):
3752
return df
3853

@@ -50,8 +65,9 @@ def _from_dataframe(df: DataFrameXchg, allow_copy=True):
5065
----------
5166
df : DataFrameXchg
5267
Object supporting the exchange protocol, i.e. `__dataframe__` method.
53-
n_chunks : int, optional
54-
Number of chunks to split `df`.
68+
allow_copy : bool, default: True
69+
Whether to allow copying the memory to perform the conversion
70+
(if false then zero-copy approach is requested).
5571
5672
Returns
5773
-------
@@ -69,7 +85,7 @@ def _from_dataframe(df: DataFrameXchg, allow_copy=True):
6985
if len(pandas_dfs) == 1:
7086
pandas_df = pandas_dfs[0]
7187
else:
72-
pandas_df = pd.concat(pandas_dfs, axis=0, ignore_index=True)
88+
pandas_df = pd.concat(pandas_dfs, axis=0, ignore_index=True, copy=False)
7389

7490
index_obj = df.metadata.get("pandas.index", None)
7591
if index_obj is not None:

0 commit comments

Comments
 (0)