pandas2
pandas2 copied to clipboard
Aligning Series.index with DataFrame.index in broadcasting operations
Copying my comment from https://github.com/pydata/pandas/issues/10000#issuecomment-236238297:
We should consider making arithmetic between a Series and a DataFrame broadcast across the columns of the dataframe, i.e., aligning series.index
with df.index
, rather than the current behavior aligning series.index
with df.columns
.
I think this would be far more useful than the current behavior, because it's much more common to want to do arithmetic between a series and all columns of a DataFrame. This would make broadcasting in pandas inconsistent with NumPy, but I think that's OK for a library that focuses on 1D/2D rather than N-dimensional data structures.