File tree 1 file changed +11
-7
lines changed
1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -482,19 +482,23 @@ column-wise:
482
482
.. ipython :: python
483
483
484
484
index = date_range(' 1/1/2000' , periods = 8 )
485
- df = DataFrame(randn(8 , 3 ), index = index,
486
- columns = [' A' , ' B' , ' C' ])
485
+ df = DataFrame(randn(8 , 3 ), index = index, columns = list (' ABC' ))
487
486
df
488
487
type (df[' A' ])
489
488
df - df[' A' ]
490
489
491
- Technical purity aside, this case is so common in practice that supporting the
492
- special case is preferable to the alternative of forcing the user to transpose
493
- and do column-based alignment like so:
490
+ .. warning ::
494
491
495
- .. ipython :: python
492
+ .. code-block :: python
493
+
494
+ df - df[' A' ]
495
+
496
+ is now deprecated and will be removed in a future release. The preferred way
497
+ to replicate this behavior is
498
+
499
+ .. code-block :: python
496
500
497
- (df.T - df [' A' ]).T
501
+ df.sub(df [' A' ], axis = 0 )
498
502
499
503
For explicit control over the matching and broadcasting behavior, see the
500
504
section on :ref: `flexible binary operations <basics.binop >`.
You can’t perform that action at this time.
0 commit comments