@@ -472,12 +472,9 @@ class DataFrame(NDFrame, OpsMixin):
472
472
Index to use for resulting frame. Will default to RangeIndex if
473
473
no indexing information part of input data and no index provided.
474
474
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.
481
478
dtype : dtype, default None
482
479
Data type to force. Only a single dtype is allowed. If None, infer.
483
480
copy : bool, default False
@@ -527,9 +524,9 @@ class DataFrame(NDFrame, OpsMixin):
527
524
1 4 5 6
528
525
2 7 8 9
529
526
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'])
533
530
...
534
531
>>> df3
535
532
c a
0 commit comments