Skip to content

Commit 7beb6f3

Browse files
pandas-dev#39904: adjustments for review
1 parent da2a451 commit 7beb6f3

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

pandas/core/frame.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,9 @@ class DataFrame(NDFrame, OpsMixin):
472472
Index to use for resulting frame. Will default to RangeIndex if
473473
no indexing information part of input data and no index provided.
474474
columns : Index or array-like
475-
Columns to select from data or column labels to use for resulting frame.
476-
Will use the provided labels for the column index if data does not
477-
include column labels, defaulting to RangeIndex(0, 1, 2, ..., n).
478-
If data does include column labels, will select the columns from data matching
479-
with the provided labels to include in the frame, defaulting to
480-
all columns.
475+
Column labels to use for resulting frame when data does not have them,
476+
defaulting to RangeIndex(0, 1, 2, ..., n). If data contains column labels,
477+
will perform column selection instead.
481478
dtype : dtype, default None
482479
Data type to force. Only a single dtype is allowed. If None, infer.
483480
copy : bool, default False
@@ -527,9 +524,9 @@ class DataFrame(NDFrame, OpsMixin):
527524
1 4 5 6
528525
2 7 8 9
529526
530-
>>> d = np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)],
531-
... dtype=[("a", "i4"), ("b", "i4"), ("c", "i4")])
532-
>>> df3 = pd.DataFrame(d, columns=['c', 'a'])
527+
>>> data = np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)],
528+
... dtype=[("a", "i4"), ("b", "i4"), ("c", "i4")])
529+
>>> df3 = pd.DataFrame(data, columns=['c', 'a'])
533530
...
534531
>>> df3
535532
c a

0 commit comments

Comments
 (0)